Package Exports
- nano-pubsub
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nano-pubsub) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
nano-pubsub
Tiny (<0.5 kb) publish/subscribe
Install
npm install nano-pubsub
Usage example
var Pubsub = require('nano-pubsub')
const events = Pubsub()
const unsubscribe = events.subscribe(value => {
console.log('got value:', value)
})
pubsub.publish('Hello')
// => 'got value: Hello'
pubsub.publish('World')
// => 'got value: World'
unsubscribe()
pubsub.publish('Something')
// ...nothing