dispatcher

dispatcher

new dispatcher()

This is the main command for the mvc framework, that which all other commands extend

Methods

(private, static) _destroyNotifier(requestedBy, name)

Destroy a notification object and call the destroy method to ensure any references it holds are also destroyed

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

(private, static) _dispatch(requestedBy, name, evnt, data, toAll)

Dispatch an event with some optional data, this will trigger all object methods set up to listen for the event

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

evnt String

The event name to check and dispatch against

data Object

The object to send with the event dispatch

toAll Boolean

Determines whether the event should be dispatched across all notifiers

Returns:

This will return a boolean value to signify if the dispatch occured

(private, static) _eachNotifier()

Each Notifier, loops through the notifications keys and executes a callback on each object

(private, static) _find(requestedBy, name, objName)

Find and specific object in the notification object via in name reference

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

objName String

The name of the object to get

Returns:

This will return the requested object or false if non was found

(private, static) _getInstances(requestedBy, name, objName)

Returns an instance count for the specified name reference and the key

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

objName String

The name of the object to get

Returns:

This will return the requested object instances or false if non was found

(private, static) _getModelData(requestedBy, name, modelName)

Returns a models data in ready only format

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

modelName String

The model name to retrieve from the notification object

Returns:

This will return the readyOnly model data if it exists or false if not

(private, static) _getModelObj(requestedBy, name, modelName)

Get a specific model from the required notification object

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

modelName String

The model name to retrieve from the notification object

Returns:

This will return the model object if it is found or false if not

(static) _getNotifier(name)

Get a notification key/object reference

Parameters:
Name Type Description
name String

The string name reference of the object

Returns:

This will return the notification object requested

(private, static) _getNotifier(requestedBy, name)

Get a notification key/object reference

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

Returns:

This will return the notification object requested

(private, static) _getViewObj(requestedBy, name, viewName)

Get a specific model from the required notification object

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

viewName String

The view name to retrieve from the notification object

Returns:

This will return the view object if it is found or false if not

(private, static) _listObjects(requestedBy, name)

Lists the stored reference names

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

Returns:

This returns a list of models by names in an array

(private, static) _register(requestedBy, name, evnt, callback, objName)

Register an object event mapping in the notification object request is made by an allowed object

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

evnt String

The event name to register in the notification object

callback String

The callback function to execute when the event is dispatched

objName String

The object reference to map the event against

Returns:

This will return false if the registration did not occur

(private, static) _registeredEvents(requestedBy, name)

Lists the registered events in the supplied notification object

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

Returns:

This will return a list or the registered events stored

(private, static) _remove(requestedBy, name, objName)

Remove a specific object from the notification object

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

objName String

The name of the object to get

Returns:

This will return false if the removal does not succeed

(private, static) _setNotifier(requestedBy, name)

Set the notification object reference

Parameters:
Name Type Description
requestedBy *

The object requesting creation of the notifier

name String

The string name reference of the object

Returns:

This will return a boolean value signifying whether the notifier was set

(static) _setNotifier(name)

Set the notification object reference

Parameters:
Name Type Description
name String

The string name reference of the object

Returns:

This will return a boolean value signifying whether the notifier was set

(private, static) _unregister(requestedBy, name, evnt, callback, objName)

Remove an object event mapping in the notification object, this will remove the event mapped completely if there is a solitary object mapped to it request is made by an allowed object

Parameters:
Name Type Description
requestedBy *

The object requesting access to the notification object

name String

The string name reference of the object

evnt String

The event name to unregister in the notification object

callback String

The callback function to execute when the event is dispatched

objName String

The object reference to unmap the event against

Returns:

This will return false if the unregister did not occcur

(static) construct()

Default construct function, should be overriden if there is any custom behaviour

(static) destroy()

Destroy this context and its references

(static) dispatch(name, evnt, data, toAll)

Dispatch an event with some optional data, this will trigger all object methods set up to listen for the event

Parameters:
Name Type Description
name String

The string name reference of the object

evnt String

The event name to check and dispatch against

data Object

The object to send with the event dispatch

toAll Boolean

Determines whether the event should be dispatched across all notifiers

Returns:

This will return a boolean value to signify if the dispatch occured

(static) find(name, objName)

Find and specific object in the notification object via in name reference

Parameters:
Name Type Description
name String

The string name reference of the object

objName String

The name of the object to get

Returns:

This will return the requested object or false if non was found

(static) getModelData(name, modelName)

Returns a models data in ready only format

Parameters:
Name Type Description
name String

The string name reference of the object

modelName String

The model name to retrieve from the notification object

Returns:

This will return the readyOnly model data if it exists or false if not

(static) getModelObj(name, modelName)

Get a specific model from the required notification object

Parameters:
Name Type Description
name String

The string name reference of the object

modelName String

The model name to retrieve from the notification object

Returns:

This will return the model object if it is found or false if not

(static) getViewObj(name, viewName)

Get a specific model from the required notification object

Parameters:
Name Type Description
name String

The string name reference of the object

viewName String

The view name to retrieve from the notification object

Returns:

This will return the view object if it is found or false if not

(static) initialize()

Initialization function is called after the object has been stored in the notification object

(static) instances(name, objName)

Returns an instance count for the specified name reference and the key

Parameters:
Name Type Description
name String

The string name reference of the object

objName String

The name of the object to get

Returns:

This will return the requested object instances or false if non was found

(static) listObjects()

Lists the stored reference names

Returns:

This returns a list of models by names in an array

(static) register(name, evnt, callback, objName)

Register an object event mapping in the notification object request is made by an allowed object

Parameters:
Name Type Description
name String

The string name reference of the object

evnt String

The event name to register in the notification object

callback String

The callback function to execute when the event is dispatched

objName String

The object reference to map the event against

Returns:

This will return false if the registration did not occur

(static) registeredEvents()

Lists the registered events in the supplied notification object

Returns:

This will return a list or the registered events stored

(static) remove(name, objName)

Remove a specific object from the notification object

Parameters:
Name Type Description
name String

The string name reference of the object

objName String

The name of the object to get

Returns:

This will return false if the removal does not succeed

(static) unregister(name, evnt, callback, objName)

Remove an object event mapping in the notification object, this will remove the event mapped completely if there is a solitary object mapped to it request is made by an allowed object

Parameters:
Name Type Description
name String

The string name reference of the object

evnt String

The event name to unregister in the notification object

callback String

The callback function to execute when the event is dispatched

objName String

The object reference to unmap the event against

Returns:

This will return false if the unregister did not occcur