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

    2.0.1 • 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

    Install

    npm i nano-pubsub

    DownloadsWeekly Downloads

    104,741

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    7.94 kB

    Total Files

    13

    Last publish

    Collaborators

    • bjoerge