Jump to navigation

Class: SignalBox

Numbas.schedule.SignalBox

new SignalBox()

Coordinates Promises corresponding to different stages in the loading process.

Source:

Methods

getCallback(name) → {Numbas.schedule.callback}

Get a callback object for the event with the given name. If the callback hasn't been accessed before, it's created.

Parameters:
Name Type Description
name string
Returns:
Type Description
Numbas.schedule.callback
Source:

halt(error)

Halt this signal box because of an error: reject all outstanding promises.

Parameters:
Name Type Description
error Error

The error that caused the signal box to halt.

Source:

on(events, fnopt) → {Promise}

Once the given event(s) have resolved, run the given callback function. Returns a Promise, so can be used without a callback.

Parameters:
Name Type Attributes Description
events string | Array.<string>

The name of an event, or a list of event names.

fn function <optional>

A callback function to run.

Returns:
Type Description
Promise

Resolves when all of the events have resolved, or rejects if the signal box is in an error state.

Source:

trigger(name)

Notify the signal box that the event with the given name has happened.

Parameters:
Name Type Description
name string
Source:

unhalt()

Unhalt this signal box: allow promises to be made again.

Source: