npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

presentation-mediator

v3.0.3

Published

The Augmented.js Next - Presentation Mediator Module.

Downloads

126

Readme

presentation-mediator

Augmented.js Presentation Mediator Module

API

Table of Contents

Mediator

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.

Parameters

delegateEvents

Extend delegateEvents() to set subscriptions

Parameters

  • events
  • event array The events to undelegate

Returns array the events

undelegateEvents

Extend undelegateEvents() to unset subscriptions

Parameters

  • events
  • event array The events to undelegate

Returns array the events

subscriptions

Subscriptions

Properties

unsetSubscriptions

Unsubscribe to each subscription

Parameters

  • subscriptions Object An optional hash of subscription to remove

Returns array subscriptions

observeColleague

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

Parameters

  • colleague 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

Returns string The identifier

observeColleagueAndTrigger

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

Parameters

  • colleague Colleague The Colleague to observe
  • channel string The Channel to add the pubished events to
  • identifier string The identifier for this function

Returns string The identifier

dismissColleague

Dismiss a Colleague View - Remove a Colleague from the channel

Parameters

  • colleague 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

Returns string The identifier

dismissColleagueTrigger

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

Parameters

  • colleague Colleague The Colleague to observe
  • channel string The Channel events are pubished to
  • identifier string The identifier for this function

Returns string The identifier

subscribe

Subscribe to a channel

Parameters

  • 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

Returns string The identifier

publish

Trigger all callbacks for a channel

Parameters

  • channel string The Channel events are pubished to
  • args ...any
  • N object Extra parameter to pass to handler

Returns string The channel

unsubscribe

Cancel subscription

Parameters

  • channel string The Channel events are pubished to
  • callback function The function callback registered (unused)
  • context object The context (or 'this')
  • identifier string The identifier for this function

Returns string The channel

subscribeOnce

Subscribing to one event only

Parameters

  • 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

Returns string The identifier

getColleagues

Get All the Colleagues for a channel

Parameters

  • channel string The Channel events are pubished to

Returns array The colleagues for a channel

channels

Property for Channels

Properties

getChannel

Get a specific channel

Parameters

  • channel string The Channel events are pubished to

Returns array Returns the requested channel or null if nothing exists

defaultChannel

Get the default channel Convenience method for _.channel = null;

Properties

  • Returns array the default channel or null if nothing exists

defaultIdentifier

Get the default identifier

Properties

  • Returns string the default identifier

Colleague

Extends View

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

Parameters

  • options object Options to pass

sendMessage

Send a message to the mediator's queue

Parameters

  • message string Message to send
  • data object Data to send with message

Returns string Message sent

setMediatorMessageQueue

Set the mediator to this colleague

Parameters

Returns Mediator The mediator

Meta

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

removeMediatorMessageQueue

Remove the mediator from this colleague

Returns boolean true

mediator

Property of the mediator

Properties