The Start Task onClick handler is defined as

$(#start-task).onClick = function()
{
  var taskElem = $(div#tasks > select)
      .$append(<option>Task { ++taskNo }
               <progress max=100 /> 
               <span.result /></option>);
  function onProgress(p100) { taskElem.$(progress).value = p100; }
  function onDone(taskId) { 
     taskElem.$(span.result).text = "Done!"; 
     taskElem.$(progress).remove(); 
  }

  view.execTask(taskId,onProgress,onDone);
}

It defines couple of callback functions and calls view.execTask() with them.

The view.execTask() native method is implemented in window::exec_task().

The window::exec_task() starts worker thread passing taskNo, onProgress and onDone parameters to it.

Worker thread body is defined in C++ as:

// worker thread body, simulate time consuming task
void thread_body(thread_params params)
{
  for(int i = 1; i <= 100; ++i) {
    ::Sleep(100);
     params.progressCb.call(i); // report task progress
  }
  // report task completion,
  // we can pass some result data here, for now just taskId
  params.doneCb.call(params.taskId);  
}

As you see it calls passed callback functions. Note: these functions are executed in GUI thread.