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

1.0.2 • Public • Published

event-source Build status npm version codecov

Reduction of an EventEmitter to a composable event-stream

Install

npm install @strong-roots-capital/event-source

Use

import { eventSource } from '@strong-roots-capital/event-source'
let a = new EventSource()
let b = new EventSource()
let es = a.merge(b.map((n: number) => 'I mapped this! ' + n))

es.on('event', (event: string | symbol, ...args: any[]) => {
    console.log(event, args)
})

a.emit('unmapped', 1)
//=> unmapped [ 1 ]

b.emit('mapped', 1)
//=> mapped [ 'I mapped this! 1' ]

Related

Acknowledgments

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i @strong-roots-capital/event-source

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

22.3 kB

Total Files

12

Last publish

Collaborators

  • amchelle
  • hamroctopus