JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 239872
  • Score
    100M100P100Q175811F
  • License MIT

Tiny (<0.5 kb) publish/subscribe

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