nano-pubsub
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    33,547
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.0
    33,547
  • 2.0.1
    60,480
  • 2.0.0
    626
  • 1.0.2
    69,218
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i nano-pubsub

Weekly Downloads

132,580

Version

3.0.0

License

MIT

Unpacked Size

6.99 kB

Total Files

9

Last publish

Collaborators

  • bjoerge