Class: Dispatcher

Dispatcher

new Dispatcher()

Represents a ScapeObject dispatcher.
Source:

Methods

dispatch(configopt)

Calls to the dispatcher are expeted to provide an arguments array, myArguments, and a function, myFunction. The first argument in myArguments should always be the object that myFunction modifes and/or returns. myFunction is evaluated for the number of expected arguments (myFunction.length) and the dispatcher appends null values for expected arguments that are missing. This is done so that a callback function can be appended to the array and all functions that are executed through the dispatcher can safely assume that the element at index myArguments.length is the dispatcher callback. Finally, a queue item consisting of the myFunction and myArguments members is pushed into the dispatcher's queue array.
Parameters:
Name Type Attributes Description
config object <optional>
Source:

id()

Returns the id specific to this Dispatcher instance. Useful if you want to setup external listeners for dispatcher events (which fire in the "socioscapes.dispatched.id" pattern).
Source: