createTaskProcessorWorker

createTaskProcessorWorker

Creates an adapter function to allow a calculation function to operate as a Web Worker, paired with TaskProcessor, to receive tasks and return results.

Parameters:
Name Type Description
workerFunction Function A function that takes as input two arguments: a parameters object, and an array into which transferable result objects can be pushed, and returns as output a result object.
Returns:
Function An adapter function that handles the interaction with TaskProcessor, specifically, task ID management and posting a response message containing the result.
Example
function doCalculation(parameters, transferableObjects) {
  // calculate some result using the inputs in parameters
  return result;
}

return Cesium.createTaskProcessorWorker(doCalculation);
// the resulting function is compatible with TaskProcessor
See:
Source: