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]
options
object Options to set
Extend delegateEvents() to set subscriptions
events
event
array The events to undelegate
Returns array the events
Extend undelegateEvents() to unset subscriptions
events
event
array The events to undelegate
Returns array the events
Subscriptions
subscriptions
array
Unsubscribe to each subscription
subscriptions
Object An optional hash of subscription to remove
Returns array subscriptions
Observe a Colleague View - observe a Colleague and add to a channel
colleague
Colleague The Colleague to observecallback
function The callback to call for this colleaguechannel
string The Channel to add the pubished events toidentifier
string 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
colleague
Colleague The Colleague to observechannel
string The Channel to add the pubished events toidentifier
string The identifier for this function
Returns string The identifier
Dismiss a Colleague View - Remove a Colleague from the channel
colleague
Presentation.Colleague The Colleague to observecallback
function The callback to call on channel eventchannel
string The Channel events are pubished toidentifier
string The identifier for this function
Returns string The identifier
Dismiss a Colleague View - Remove a Colleague from the channel that has an auto trigger
colleague
Colleague The Colleague to observechannel
string The Channel events are pubished toidentifier
string The identifier for this function
Returns string The identifier
Subscribe to a channel
channel
string The Channel events are pubished tocallback
function The callback to call on channel eventcontext
object The context (or 'this')once
boolean Toggle to set subscribe only onceidentifier
string The identifier for this function
Returns string The identifier
Trigger all callbacks for a channel
channel
string The Channel events are pubished toargs
...anyN
object Extra parameter to pass to handler
Returns string The channel
Cancel subscription
channel
string The Channel events are pubished tocallback
function The function callback registered (unused)context
object The context (or 'this')identifier
string The identifier for this function
Returns string The channel
Subscribing to one event only
channel
string The Channel events are pubished tosubscription
string The subscription to subscribe tocontext
object The context (or 'this')identifier
string The identifier for this function
Returns string The identifier
Get All the Colleagues for a channel
channel
string The Channel events are pubished to
Returns array The colleagues for a channel
Property for Channels
channels
array
Get a specific channel
channel
string 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;
Returns
array the default channel or null if nothing exists
Get the default identifier
Returns
string 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
options
object Options to pass
Send a message to the mediator's queue
Returns string Message sent
Set the mediator to this colleague
mediator
Mediator 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
mediator
Mediator