Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import { tap, take, skip, concat, fromArray, runEffects } from '../packages/core/src/index'
import { newDefaultScheduler } from '../packages/scheduler/src/index'
import { EventEmitter } from 'events'
import multicastStream from '@most/multicast'
import { fromEvent } from 'most'
const emitter = new EventEmitter()
const scheduler = newDefaultScheduler()
const observe = (f, stream) => runEffects(tap(f, stream), scheduler)
const multicast = (stream) => multicastStream(stream).source
const stream = multicast(fromEvent('event', emitter))
const result = concat(take(1, stream), skip(1, stream))
observe(console.log, result)
for ( let i = 1; i <= 5; i++ )
emitter.emit( 'event', i );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.