Namespace

sandboxEnv

dcp/compute~sandboxEnv

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 level (see Job#event:console.level).

debug function

fire console event with 'debug' as level (see Job#event:console.level).

info function

fire console event with 'info' as level (see Job#event:console.level).

warn function

fire console event with 'warn' as level (see Job#event:console.level).

error function

fire console event with 'error' as level (see Job#event:console.level).

Note some ES environments (Chrome, Firefox) implement C-style print formatting in this method. This is currently not supported.

OffscreenCanvas

# 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 eventName. This event is received client-side with those args (see Job#work).

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 % symbol, it will be interpreted as a number in the usual mathematical sense. If the argument is undefined, the slice progress is noted but the amount of progress is considered to be indeterminate.

true

boolean