new Cesium.TaskProcessor(workerPath, maximumActiveTasks)

围着一个网络工人 允许为特定工人安排任务, 以诺言同步返回结果. 工人在预定任务之前不会建造.
Name Type Default Description
workerPath string 乌尔对工人。 这可以是绝对路径,也可以是相对于 Cesium 工人文件夹.
maximumActiveTasks number Number.POSITIVE_INFINITY optional The maximum number of active tasks. Once exceeded, 计划任务将不再排队任务, 允许 工作将在未来框架中重新安排.

Methods

destroy()

摧毁此对象。 这将立即终止工人.

Once an object is destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.

initWebAssemblyModule(webAssemblyOptions)Promise.<*>

向配置初始化加载的网络工作人员发送信件 并同步编译一个网络集成模块和一个可选模块 如果不支持Web Assembly,则要使用的JavaScript倒置模块.
Name Type Description
webAssemblyOptions object optional 具有下列属性的天体:
Name Type Description
modulePath string optional 网络集合JavaScript包装模块的路径.
wasmBinaryFile string optional 网页集合二进制文件的路径 .
fallbackModulePath string optional 如果不支持Web组装,则使用JavaScript倒计时模块的路径.
Returns:
当网络工人已经装入和编译了网络组装模块并准备处理任务时,这个承诺就能解决结果.
Throws:
  • RuntimeError : This browser does not support Web Assembly, and no backup module was provided

isDestroyed()boolean

如果此对象被销毁, 返回真实; 否则, 错误 .

If this object was destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.
Returns:
如果此天体被销毁, 则属真; 否则, 属假 .
See:

scheduleTask(parameters, transferableObjects)Promise.<object>|undefined

安排一个由网络工人同步处理的任务。 如果还有更多 任务会立即返回未定义的状态. 否则,返回一个承诺,以决定工人在以下情况下所报的结果: finished.
Name Type Description
parameters object 将向工人公布的任何输入数据.
transferableObjects Array.<object> optional 参数中包含的一系列对象 转移给工人而不是复制.
Returns:
或承诺,在有结果时予以解决,或 如果任务太多,
Example:
const taskProcessor = new Cesium.TaskProcessor('myWorkerPath');
const promise = taskProcessor.scheduleTask({
    someParameter : true,
    another : 'hello'
});
if (!Cesium.defined(promise)) {
    // too many active tasks - try again later
} else {
    promise.then(function(result) {
        // use the result of the task
    });
}
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.