This JSDoc 'namespace' is a convenient way to document some globals that are available only in the sandbox environment provided to work functions.
Members
# static console
Emit a console
event to the JobHandle
in the client. If the sandbox is running in an environment with a native console object, the native method may also be invoked.
Properties:
Name | Type | Description |
---|---|---|
log |
function | fire console event with 'log' as |
debug |
function | fire console event with 'debug' as |
info |
function | fire console event with 'info' as |
warn |
function | fire console event with 'warn' as |
error |
function | fire console event with 'error' as Note some ES environments (Chrome, Firefox) implement C-style print formatting in this method. This is currently not supported. |
# static OffscreenCanvas
As defined in the HTML Standard, provides a canvas which can be rendered off-screen. If this interface is not available in a given worker, the worker will not report capability "offscreenCanvas".
# static work
Properties:
Name | Type | Description |
---|---|---|
emit |
function | (eventName, ...) - send arbitrary args with |
job |
object | |
public |
object | Property set on job handle, see Job#public. |
Methods
# static progress(n) → {boolean}
This function emits a progress event. Progress events should be emitted approximately once per second; a task which fails to emit a progress event for a certain period of time will be cancelled by the supervisor. The argument to this function is interpreted to six significant digits, and must increase for every call. All work functions must emit at least one progress event - this requirement will be enforced by the estimator. * The period of time mentioned above will be at least 30 wall-clock seconds and at least 30 benchmark-adjusted seconds
Parameters:
Name | Type | Description |
---|---|---|
n |
string | number | undefined | a number between 0 and 1 (inclusive) that represents a best-guess
at the completed portion of the task as a ratio of completed work to total work. If the argument is a string ending in the |
true