JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 241598
  • Score
    100M100P100Q172581F
  • 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

const Pubsub = require('nano-pubsub')

const events = Pubsub()

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