UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

85 lines 1.96 kB
export default WorkerProxy; declare class WorkerProxy { /** * * @param {string} url * @param {Object} methods */ constructor(url: string, methods: any); /** * * @type {Object<Array<{id:number, parameters:[], resolve: function, reject:function}>>} * @private */ private __pending; __isRunning: boolean; /** * * @type {Worker|null} * @private */ private __worker; /** * * @type {number} * @private */ private __id_counter; /** * Created worker will assume this name as well * Useful for debug purposes and reflection * @type {string} * @private */ private __name; url: string; methods: any; /** * Invoke a given method on the worker, as defined by the `WorkerBuilder` * @template T * @param {string} name Method's name * @param {Array} args * @return {Promise<T>} eventual result of the invoked method */ $submitRequest<T>(name: string, args: any[]): Promise<T>; /** * * @param {string} name * @private */ private __makeMethod; /** * * @private */ private __generateAPI; /** * * @param {Event} event * @private */ private __handleMessage; isRunning(): boolean; /** * Stop the worker. * If the worker is not running, this method does nothing. */ stop(): void; /** * * @param {number} id * @param {string} method_name * @returns {boolean} */ cancelRequest(id: number, method_name: string): boolean; sendPendingRequests(): void; /** * Start the worker. * Any requests made while the worker is not running will be queued and sent once the worker is started. * * If the worker is already running, this method does nothing. * */ start(): void; } //# sourceMappingURL=WorkerProxy.d.ts.map