WebWorker

Core. WebWorker

A light wrapper around a Web Worker that makes sending/receiving messages with the worker easier.

Constructor

new WebWorker()

Source:

Classes

WebWorker

Methods

post(operation, dataopt) → {Promise.<Object>}

Post a message to the web worker and await the response.

Source:
Parameters:
Name Type Attributes Description
operation String

The operation for the worker to perform.

data * <optional>

The data to pass to the worker to operate on.

Returns:
Type:
Promise.<Object>

Resolves to the result of the operation.

stream(operation, dataOrCallback, callbackopt)

Trigger a web worker operation and subscribe a callback to its stream of emitted events.

Source:
Parameters:
Name Type Attributes Description
operation String

The operation for the worker to perform.

dataOrCallback * | function

The data to pass to the worker to operate on, or the callback function to call if no data needs to be passed.

callback function <optional>

terminate()

Terminate the web worker.

Source: