UNPKG

kefir

Version:

Reactive Programming library for JavaScript inspired by Bacon.js and RxJS with focus on high performance and low memory usage

16 lines (13 loc) 314 B
import stream from './stream' export default function fromCallback(callbackConsumer) { let called = false return stream(function(emitter) { if (!called) { callbackConsumer(function(x) { emitter.emit(x) emitter.end() }) called = true } }).setName('fromCallback') }