nano-pubsub
v3.0.0
Published
Zero dependency, tiny (<0.5 kb) publish/subscribe
Downloads
773,048
Maintainers
Readme
nano-pubsub
Tiny (<0.5 kb) publish/subscribe
Install
npm install nano-pubsub
Usage example
import createPubsub from 'nano-pubsub'
const events = createPubsub()
const unsubscribe = events.subscribe(value => {
console.log('got value:', value)
})
events.publish('Hello')
// => 'got value: Hello'
events.publish('World')
// => 'got value: World'
unsubscribe()
events.publish('Something')
// ...nothing