Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
A small library that implements the Mediator Pattern in JavaScript. The essence of the Mediator pattern is to "Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently". Read more
Medium makes use of the Mediator pattern and the difference of the Mediator pattern over the Observer pattern is that a single object is responsible for communication. Read more
$ npm install mediumjs
$ bower install mediumjs
$ component install pazguille/mediumjs
See: https://github.com/component/component
First, requires the mediator instance:
var medium = require('medium');
Now, defines a listener and subcribes to a channel:
function informal(arg1, arg2) {
alert(arg1);
alert(arg2);
});
medium.subscribe('greet', informal);
Then, broadcasts a channel with some data:
medium.publish('greet', 'Hi pazguille!', 'Bye pazguille!');
Adds a listener
to given channel
.
channel
- The name of the channel you want to subscribe.listener
- Listener you want to execute to given channel.medium.subscribe('greet', informal);
Execute each item in the listener
collection in order with given parameters
.
channel
- The name of the channel you want to subscribe.medium.publish('greet', 'Hi pazguille!', 'Bye pazguille!');
Removes one or all listeners
from the collection with given channel
.
channel
- The name of the channel you want to remove.listener
(optional) - Listener you want to remove from given channel.// removes a specific listener from the given channel
medium.remove('greet', informal);
// removes all listeners and the channel
medium.remove('greet');
Licensed under the MIT license.
Copyright (c) 2013 @pazguille.
FAQs
A small library that implements the Mediator Pattern in JavaScript.
We found that mediumjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.