import { EventHandler } from '../core/eventhandler'; /** * A wrapper around a web worker that allows scheduling tasks for a given worker, * returning results asynchronously via a promise. * * The Worker is not constructed until a task is scheduled. * * @alias TaskProcessor * @constructor * * @param {String} workerPath The Url to the worker. This can either be an absolute path or relative to the Cesium Workers folder. * @param {Number} [maximumActiveTasks=5] The maximum number of active tasks. Once exceeded, * scheduleTask will not queue any more tasks, allowing * work to be rescheduled in future frames. * * @example * encodedVertexBuffer.subarray 可以分段操作内存 * const taskProcessor = new TaskProcessor("/transferTypedArrayTest1.js"); * var objData = * { * str: "string", * ab: new ArrayBuffer(10), * i8: new Int8Array(10) * }; * objData.i8[0] = 12; * * const tPromise1 = taskProcessor.scheduleTask(objData, [objData.ab, objData.i8.buffer]) * if (tPromise1) * tPromise1.then((data) => { * console.log('in app 1'); * console.dir(data); * }) * */ export declare class TaskProcessor extends EventHandler { static _defaultWorkerModulePrefix: string; static _workerModulePrefix: string; static _canTransferArrayBuffer: boolean; workerPath: string; private _maximumActiveTasks; _activeTasks: number; _promises: any; private _nextID; private _worker; constructor(workerPath: string, maximumActiveTasks?: number); createWorker(): Worker; completeTask(data: { id: number; error: any; result: any; }): void; scheduleTask(parameters: any, transferableObjects: any): Promise | undefined; isDestroyed(): boolean; /** * Destroys this object. This will immediately terminate the Worker. *

* Once an object is destroyed, it should not be used; calling any function other than * isDestroyed will result in a {@link DeveloperError} exception. */ destroy(): void; }