Allow JS to yield and allow GUI to update

Lee's icon

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

Joshua Kit Clayton's icon

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
Lee's icon

Lovely. Thanks for the info :)