@JsType(isNative=true, namespace="Cesium", name="TaskProcessor") public class TaskProcessor extends Object
Constructor and Description |
---|
TaskProcessor(String workerName)
A wrapper around a web worker that allows scheduling tasks for a given worker, returning results asynchronously
via a promise.
|
TaskProcessor(String workerName,
int maximumActiveTasks)
A wrapper around a web worker that allows scheduling tasks for a given worker, returning results asynchronously
via a promise.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys this object.
|
Promise<Object,Void> |
initWebAssemblyModule()
Posts a message to a web worker with configuration to initialize loading and compiling a web assembly module
asychronously, as well as an optional fallback JavaScript module to use if Web Assembly is not supported.
|
Promise<Object,Void> |
initWebAssemblyModule(WebAssemblyOptions options)
Posts a message to a web worker with configuration to initialize loading and compiling a web assembly module
asychronously, as well as an optional fallback JavaScript module to use if Web Assembly is not supported.
|
boolean |
isDestroyed()
Returns true if this object was destroyed; otherwise, false.
|
Promise<Object,Void> |
scheduleTask(JsObject parameters)
Schedule a task to be processed by the web worker asynchronously.
|
Promise<Object,Void> |
scheduleTask(JsObject parameters,
Object[] transferableObjects)
Schedule a task to be processed by the web worker asynchronously.
|
@JsConstructor public TaskProcessor(String workerName)
workerName
- The name of the worker. This is expected to be a script in the Workers folder.@JsConstructor public TaskProcessor(String workerName, int maximumActiveTasks)
workerName
- The name of the worker. This is expected to be a script in the Workers folder.maximumActiveTasks
- The maximum number of active tasks. Once exceeded, scheduleTask will not
queue any more tasks, allowing work to be rescheduled in future frames.@JsMethod public void destroy()
@JsMethod public Promise<Object,Void> initWebAssemblyModule()
@JsMethod public Promise<Object,Void> initWebAssemblyModule(WebAssemblyOptions options)
options
- WebAssemblyOptions
object.@JsMethod public boolean isDestroyed()
destroy()
@JsMethod public Promise<Object,Void> scheduleTask(JsObject parameters)
parameters
- Any input data that will be posted to the worker.@JsMethod public Promise<Object,Void> scheduleTask(JsObject parameters, Object[] transferableObjects)
parameters
- Any input data that will be posted to the worker.transferableObjects
- An array of objects contained in parameters that should be transferred to the worker instead of copied.Copyright © 2019. All rights reserved.