transmitter

3.0.1 • Public • Published

transmitter

Dead simple pub-sub

API

subscribe(onChange: () => any): { dispose: () => void }

Subscribes to change events. Returns an object which contains the method dispose which removes the current subscription.

publish(...payload: any): void

Emit a change to all the subscribers.

Example

const bus = transmitter()
 
bus.subscribe(result => console.log(result))
 
bus.publish({ foo: 'bar' })

License

MIT

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i transmitter

    Weekly Downloads

    10,663

    Version

    3.0.1

    License

    MIT

    Last publish

    Collaborators

    • goatslacker