1.1.0 • Published 6 years ago

callbag-from-events v1.1.0

Weekly downloads
1,026
License
MIT
Repository
github
Last release
6 years ago

callbag-from-events

Create a Callbag from:

  • any object with on/off methods,
  • a DOM EventTarget,
  • or a Node.JS EventEmitter.
import fromEvents from 'callbag-from-events'
import { map, filter } from 'callbag-basics'
import { ipcMain } from 'electron'
import { nodeEvents } from './server'

const chatReceived = fromEvents(nodeEvents, 'chat-received')
  |> filter(message => message.length > 0)
  |> map(message => ({ chat: message }))

const buttonClicked = fromEvents(document.getElementById('start'), 'click')

const processCompleted = fromEvents(ipcMain, 'process-completed')
1.1.0

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago