Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

envoi

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

envoi

Loosly coupled and namespaced communication. Mediator, pub/sub pattern.

  • 0.0.2
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Envoi

Loosly coupled and namespaced communication. Mediator, pub/sub pattern.

Installation

$ npm install envoi

Usage

var Envoi = require( 'envoi' ).Envoi
var envoi = new Envoi()

envoi.subscribe( "chat", logChatEvent )
envoi.subscribe( "chat::message", displayMessage )

// 'chat' and 'chat::message' will fire because of namespacing
envoi.publish( "chat::message", "shaggy87", "lol dope" )

Api

Envoi.prototype.subscribe( channel, callback, context )

Subscribe to the given channel/namespace. Call the given callback with the given context as 'this' when that channels is published to.

Envoi.prototype.unsubscribe( channel, callback )

Unsubscribe from channel. If only channel is given all callbacks that match the channels namspace will be removed. If callback is given it will only remove subscriptions that has that specific callback

Envoi.prototype.publish( channel, args.. )

Publishes to the channel, calling all subscribing callbacks with the rest of the arguments as arguments to the calback function[s].

License

MIT licensed

FAQs

Package last updated on 02 Oct 2013

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc