Hmm, I had thought, after posting it, that I should change the order like: else { page . set ( "showlighting" , true ) page . set ( "lightglobalillum" , false ) if ( map2 ) toFront ( map2 ) } But the lighting change happened for me first, with no flash of the map. Anyways, I don't know Underscore.js much, but setTimeout seems to work: if (page.get('showlighting'))
{
if(map1) toFront(map1)
setTimeout(() =>
{
page.set("lightglobalillum", true)
page.set("showlighting", false)
}, 500)
}
else
{
page.set("showlighting", true)
page.set("lightglobalillum", false)
setTimeout(() => {if(map2) toFront(map2)}, 500)
} Edit: Looking at the Underscore.js documentation it can work. Your code above only delays logging though, it doesn't make the rest of the code await that logging. It's really just the same as setTimeout, as far as I can tell. if (page.get('showlighting'))
{
if(map1) toFront(map1)
_.delay(() =>
{
page.set("lightglobalillum", true)
page.set("showlighting", false)
}, 500)
}
else
{
page.set("showlighting", true)
page.set("lightglobalillum", false)
_.delay(() => {if(map2) toFront(map2)}, 500)
}