# presentation-mediator

> The Augmented.js Next - Presentation Mediator Module.

Latest version **3.0.3** (published 2022-02-28) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install presentation-mediator
pnpm add presentation-mediator
yarn add presentation-mediator
bun add presentation-mediator
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.3 |
| Published | 2022-02-28 |
| First published | 2018-08-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 56.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bob Warren |
| Maintainers | thedocbwarren |
| Keywords | augmentedjs, presentation, mediator, pubsub |

## Links

- npm: https://www.npmjs.com/package/presentation-mediator
- Repository: https://github.com/Augmentedjs/presentation-mediator
- Homepage: http://www.augmentedjs.com
- Issues: https://github.com/Augmentedjs/presentation-mediator/issues
- npm.io page: https://npm.io/package/presentation-mediator

## Dependencies (2)

- [presentation-view](https://npm.io/package/presentation-view.md) ^3.0.2
- [next-core-utilities](https://npm.io/package/next-core-utilities.md) ^3.4.1

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 3.0.3 (latest) — 2022-02-28
- 3.0.2 — 2022-02-28
- 3.0.1 — 2020-07-19
- 3.0.0 — 2020-05-02
- 2.7.1 — 2019-06-26
- 2.7.0 — 2019-06-23
- 2.5.9 — 2019-03-31
- 2.5.8 — 2018-11-12
- 2.5.7 — 2018-08-21
- 2.5.6 — 2018-08-21
- 2.5.5 — 2018-08-16
- 2.5.4 — 2018-08-14
- 2.5.3 — 2018-08-12
- 2.5.2 — 2018-08-10

## README

# presentation-mediator

Augmented.js Presentation Mediator Module

# API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

*   [Mediator](#mediator)
    *   [Parameters](#parameters)
    *   [delegateEvents](#delegateevents)
        *   [Parameters](#parameters-1)
    *   [undelegateEvents](#undelegateevents)
        *   [Parameters](#parameters-2)
    *   [subscriptions](#subscriptions)
        *   [Properties](#properties)
    *   [unsetSubscriptions](#unsetsubscriptions)
        *   [Parameters](#parameters-3)
    *   [observeColleague](#observecolleague)
        *   [Parameters](#parameters-4)
    *   [observeColleagueAndTrigger](#observecolleagueandtrigger)
        *   [Parameters](#parameters-5)
    *   [dismissColleague](#dismisscolleague)
        *   [Parameters](#parameters-6)
    *   [dismissColleagueTrigger](#dismisscolleaguetrigger)
        *   [Parameters](#parameters-7)
    *   [subscribe](#subscribe)
        *   [Parameters](#parameters-8)
    *   [publish](#publish)
        *   [Parameters](#parameters-9)
    *   [unsubscribe](#unsubscribe)
        *   [Parameters](#parameters-10)
    *   [subscribeOnce](#subscribeonce)
        *   [Parameters](#parameters-11)
    *   [getColleagues](#getcolleagues)
        *   [Parameters](#parameters-12)
    *   [channels](#channels)
        *   [Properties](#properties-1)
    *   [getChannel](#getchannel)
        *   [Parameters](#parameters-13)
    *   [defaultChannel](#defaultchannel)
        *   [Properties](#properties-2)
    *   [defaultIdentifier](#defaultidentifier)
        *   [Properties](#properties-3)
*   [Colleague](#colleague)
    *   [Parameters](#parameters-14)
    *   [sendMessage](#sendmessage)
        *   [Parameters](#parameters-15)
    *   [setMediatorMessageQueue](#setmediatormessagequeue)
        *   [Parameters](#parameters-16)
    *   [removeMediatorMessageQueue](#removemediatormessagequeue)
    *   [mediator](#mediator-1)
        *   [Properties](#properties-4)

## Mediator

**Extends Colleague**

Mediator View - The mediator in the Mediator Pattern<br/>
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.

<pre>
[Mediator]<-----[Colleague]
    ^-----------[Colleague]
</pre>

### Parameters

*   `options` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options to set

### delegateEvents

Extend delegateEvents() to set subscriptions

#### Parameters

*   `events`  
*   `event` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The events to undelegate

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** the events

### undelegateEvents

Extend undelegateEvents() to unset subscriptions

#### Parameters

*   `events`  
*   `event` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The events to undelegate

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** the events

### subscriptions

Subscriptions

#### Properties

*   `subscriptions` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** 

### unsetSubscriptions

Unsubscribe to each subscription

#### Parameters

*   `subscriptions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An optional hash of subscription to remove

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** subscriptions

### observeColleague

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

#### Parameters

*   `colleague` **[Colleague](#colleague)** The Colleague to observe
*   `callback` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The callback to call for this colleague
*   `channel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Channel to add the pubished events to
*   `identifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier for this function

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier

### observeColleagueAndTrigger

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

#### Parameters

*   `colleague` **[Colleague](#colleague)** The Colleague to observe
*   `channel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Channel to add the pubished events to
*   `identifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier for this function

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier

### dismissColleague

Dismiss a Colleague View - Remove a Colleague from the channel

#### Parameters

*   `colleague` **Presentation.Colleague** The Colleague to observe
*   `callback` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The callback to call on channel event
*   `channel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Channel events are pubished to
*   `identifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier for this function

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier

### dismissColleagueTrigger

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

#### Parameters

*   `colleague` **[Colleague](#colleague)** The Colleague to observe
*   `channel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Channel events are pubished to
*   `identifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier for this function

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier

### subscribe

Subscribe to a channel

#### Parameters

*   `channel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Channel events are pubished to
*   `callback` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The callback to call on channel event
*   `context` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The context (or 'this')
*   `once` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Toggle to set subscribe only once
*   `identifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier for this function

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier

### publish

Trigger all callbacks for a channel

#### Parameters

*   `channel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Channel events are pubished to
*   `args` **...any** 
*   `N` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Extra parameter to pass to handler

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The channel

### unsubscribe

Cancel subscription

#### Parameters

*   `channel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Channel events are pubished to
*   `callback` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The function callback registered (unused)
*   `context` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The context (or 'this')
*   `identifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier for this function

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The channel

### subscribeOnce

Subscribing to one event only

#### Parameters

*   `channel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Channel events are pubished to
*   `subscription` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The subscription to subscribe to
*   `context` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The context (or 'this')
*   `identifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier for this function

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The identifier

### getColleagues

Get All the Colleagues for a channel

#### Parameters

*   `channel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Channel events are pubished to

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The colleagues for a channel

### channels

Property for Channels

#### Properties

*   `channels` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** 

### getChannel

Get a specific channel

#### Parameters

*   `channel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The Channel events are pubished to

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Returns the requested channel or null if nothing exists

### defaultChannel

Get the default channel<br/>
Convenience method for \_.channel = null;

#### Properties

*   `Returns` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** the default channel or null if nothing exists

### defaultIdentifier

Get the default identifier

#### Properties

*   `Returns` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the default identifier

## Colleague

**Extends View**

<em>Colleague View</em> — The 'child' view.<br/>
The Colleague communicates with other Colleagues through its Mediator.<br/>
Supported options:\</br/>

<ul>
<li>mediator - A mediator for this view</li>
</ul>

### Parameters

*   `options` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options to pass

### sendMessage

Send a message to the mediator's queue

#### Parameters

*   `message` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Message to send
*   `data` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Data to send with message

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Message sent

### setMediatorMessageQueue

Set the mediator to this colleague

#### Parameters

*   `mediator` **[Mediator](#mediator)** The mediator

Returns **[Mediator](#mediator)** The mediator

**Meta**

*   **deprecated**: set with: this.mediator = ...

### removeMediatorMessageQueue

Remove the mediator from this colleague

Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true

### mediator

Property of the mediator

#### Properties

*   `mediator` **[Mediator](#mediator)**

---
_Source: https://npm.io/package/presentation-mediator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
