@strong-roots-capital/observe
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

observe Build status npm version codecov

Observe and react to an EventSource

Install

npm install @strong-roots-capital/observe

Use

import observe from '@strong-roots-capital/observe'
import { EventSource } from '@strong-roots-capital/event-source'

function callback() {
    console.log('In callback')
}

const es = new EventSource()
const observer = observe(es,callback)

es.emit('eventA')
//=> In callback

es.emit('eventB')
//=> In callback

observer.dispose()

es.emit('eventA')

Related

Acknowledgments

Package Sidebar

Install

npm i @strong-roots-capital/observe

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

14.8 kB

Total Files

11

Last publish

Collaborators

  • amchelle
  • hamroctopus