Is there a method to force the UI to update like requestAnimationFrame()?


#1

I have a loop that freezes the UI for a few seconds. Until setTimeout and setInterval is available is there a way to request that the UI of the plugin be update?

For example,

myLabel.text = "Running process...please wait";
for (var i=0;i<100k;i++) {
    // run through artboards 
}

In the example above the label is not updated until midway? to or after the for loop ends. The update method would force the display to be drawn. It could be async.

myLabel.text = "Running process...please wait";
requestAnimationFrame(); // update the UI
for (var i=0;i<100k;i++) {
    // run through artboards 
}

#2

I don’t know of an easy way here short of using a dummy network or file I/O request… I think those would insert enough asynchrony to give the UI time to update, but I’m not sure if it would be consistent or not across machines with different performance profiles.