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 hiven 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:

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: