Allow JS to yield and allow GUI to update

Jan 22, 2013 at 12:16pm

Allow JS to yield and allow GUI to update

Hi, is there anything that can be done in a long process in js to allow the ui to run so that any updates waiting to go to the max window can be made?
thx
L

#66173
Jan 24, 2013 at 9:41pm

Not implicitly. You can explicitly break your operation into multiple slices, and use the Task object to periodically call your worker function in slices. e.g. something like the following.


var current_slice=0;
var worker_task = new Task(doslice);

function startwork()
{
  current_slice=0;
  doslice();
}

function doslice()
{
  // do some portion of the work here;
  current_slice++;
  if (current_slice
#238191
Jan 25, 2013 at 1:42pm

Lovely. Thanks for the info :)

#238192

You must be logged in to reply to this topic.