Class: Mediator

.Presentation. Mediator


new Mediator()

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]
Source:

Extends

Methods


<static> dismissColleague(colleague, callback, channel, identifier)

Dismiss a Colleague View - Remove a Colleague from the channel

Parameters:
Name Type Description
colleague Augmented.Presentation.Colleague

The Colleague to observe

callback function

The callback to call on channel event

channel string

The Channel events are pubished to

identifier string

The identifier for this function

Source:

<static> dismissColleagueTrigger(colleague, channel, identifier)

Dismiss a Colleague View - Remove a Colleague from the channel that has an auto trigger

Parameters:
Name Type Description
colleague Augmented.Presentation.Colleague

The Colleague to observe

channel string

The Channel events are pubished to

identifier string

The identifier for this function

Source:

<static> getChannel(channel)

Get a specific channel

Parameters:
Name Type Description
channel string

The Channel events are pubished to

Source:
Returns:

Returns the requested channel or null if nothing exists

Type
array

<static> getChannels()

Get Channels

Source:
Returns:

Returns all the channels

Type
object

<static> getColleagues(channel)

Get All the Colleagues for a channel

Parameters:
Name Type Description
channel string

The Channel events are pubished to

Source:
Returns:

The colleagues for a channel

Type
array

<static> getDefaultChannel()

Get the default channel
Convenience method for getChannel(null)

Source:
Returns:

Returns the default channel or null if nothing exists

Type
array

<static> getDefaultIdentifier()

Get the default identifier

Source:
Returns:

Returns the default identifier

Type
string

<static> observeColleague(colleague, channel, identifier)

Observe a Colleague View - observe a Colleague and add to a channel and auto trigger events

Parameters:
Name Type Description
colleague Augmented.Presentation.Colleague

The Colleague to observe

channel string

The Channel to add the pubished events to

identifier string

The identifier for this function

Source:

<static> observeColleague(colleague, callback, channel, identifier)

Observe a Colleague View - observe a Colleague and add to a channel

Parameters:
Name Type Description
colleague Augmented.Presentation.Colleague

The Colleague to observe

callback function

The callback to call for this colleague

channel string

The Channel to add the pubished events to

identifier string

The identifier for this function

Source:

<static> publish(channel, N)

Trigger all callbacks for a channel

Parameters:
Name Type Description
channel string

The Channel events are pubished to

N object

Extra parameter to pass to handler

Source:

<static> subscribe(channel, callback, context, once, identifier)

Subscribe to a channel

Parameters:
Name Type Description
channel string

The Channel events are pubished to

callback function

The callback to call on channel event

context object

The context (or 'this')

once boolean

Toggle to set subscribe only once

identifier string

The identifier for this function

Source:

<static> subscribeOnce(channel, subscription, context, identifier)

Subscribing to one event only

Parameters:
Name Type Description
channel string

The Channel events are pubished to

subscription string

The subscription to subscribe to

context object

The context (or 'this')

identifier string

The identifier for this function

Source:

<static> unsubscribe(channel, callback, context, identifier)

Cancel subscription

Parameters:
Name Type Description
channel string

The Channel events are pubished to

callback function

The function callback regestered

context object

The context (or 'this')

identifier string

The identifier for this function

Source: