Augmented.js Presentation Mediator Module
- Mediator
- Colleague
Extends Colleague
Mediator View - The mediator in the Mediator Pattern
The mediator defines the interface for communication between colleague views.
Loose coupling between colleague objects is achieved by having colleagues communicate
with the Mediator, rather than with each other.
[Mediator]<-----[Colleague]
^-----------[Colleague]
optionsobject Options to set
Extend delegateEvents() to set subscriptions
eventseventarray The events to undelegate
Returns array the events
Extend undelegateEvents() to unset subscriptions
eventseventarray The events to undelegate
Returns array the events
Subscriptions
subscriptionsarray
Unsubscribe to each subscription
subscriptionsObject An optional hash of subscription to remove
Returns array subscriptions
Observe a Colleague View - observe a Colleague and add to a channel
colleagueColleague The Colleague to observecallbackfunction The callback to call for this colleaguechannelstring The Channel to add the pubished events toidentifierstring The identifier for this function
Returns string The identifier
Observe a Colleague View - observe a Colleague and add to a channel and auto trigger events
colleagueColleague The Colleague to observechannelstring The Channel to add the pubished events toidentifierstring The identifier for this function
Returns string The identifier
Dismiss a Colleague View - Remove a Colleague from the channel
colleaguePresentation.Colleague The Colleague to observecallbackfunction The callback to call on channel eventchannelstring The Channel events are pubished toidentifierstring The identifier for this function
Returns string The identifier
Dismiss a Colleague View - Remove a Colleague from the channel that has an auto trigger
colleagueColleague The Colleague to observechannelstring The Channel events are pubished toidentifierstring The identifier for this function
Returns string The identifier
Subscribe to a channel
channelstring The Channel events are pubished tocallbackfunction The callback to call on channel eventcontextobject The context (or 'this')onceboolean Toggle to set subscribe only onceidentifierstring The identifier for this function
Returns string The identifier
Trigger all callbacks for a channel
channelstring The Channel events are pubished toargs...anyNobject Extra parameter to pass to handler
Returns string The channel
Cancel subscription
channelstring The Channel events are pubished tocallbackfunction The function callback registered (unused)contextobject The context (or 'this')identifierstring The identifier for this function
Returns string The channel
Subscribing to one event only
channelstring The Channel events are pubished tosubscriptionstring The subscription to subscribe tocontextobject The context (or 'this')identifierstring The identifier for this function
Returns string The identifier
Get All the Colleagues for a channel
channelstring The Channel events are pubished to
Returns array The colleagues for a channel
Property for Channels
channelsarray
Get a specific channel
channelstring The Channel events are pubished to
Returns array Returns the requested channel or null if nothing exists
Get the default channel
Convenience method for _.channel = null;
Returnsarray the default channel or null if nothing exists
Get the default identifier
Returnsstring the default identifier
Extends View
Colleague View — The 'child' view.
The Colleague communicates with other Colleagues through its Mediator.
Supported options:</br/>
- mediator - A mediator for this view
optionsobject Options to pass
Send a message to the mediator's queue
Returns string Message sent
Set the mediator to this colleague
mediatorMediator The mediator
Returns Mediator The mediator
Meta
- deprecated: set with: this.mediator = ...
Remove the mediator from this colleague
Returns boolean true
Property of the mediator
mediatorMediator