Creates an adapter function to allow a calculation function to operate as a Web Worker, paired with TaskProcessor, to receive tasks and return results.
Name Type Description
workerFunction createTaskProcessorWorker~WorkerFunction The calculation function, which takes parameters and returns a result.
A function that adapts the calculation function to work as a Web Worker onmessage listener with TaskProcessor.
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

Type Definitions


A Web Worker message event handler function that handles the interaction with TaskProcessor, specifically, task ID management and posting a response message containing the result.
Name Type Description
event Object The onmessage event object.

WorkerFunction(parameters, transferableObjects)Object

A function that performs a calculation in a Web Worker.
Name Type Description
parameters Object Parameters to the calculation.
transferableObjects Array An array that should be filled with references to objects inside the result that should be transferred back to the main document instead of copied.
The result of the calculation.
function calculate(parameters, transferableObjects) {
  // perform whatever calculation is necessary.
  var typedArray = new Float32Array(0);

  // typed arrays are transferable

  return {
     typedArray : typedArray