uci-utils-to-boolean/examples/example.js

18 lines
398 B
JavaScript

import Ready from '../src/ready'
import { EventEmitter } from 'events'
let emitter = new EventEmitter()
let process = new Ready({emitter: emitter, condition: (ev=> {return ev===true}) })
process.addObserver('one')
process.addObserver('two')
process.addObserver('three')
process.subscribe()
emitter.emit('one',true)
emitter.emit('two',true)
emitter.emit('three',true)
emitter.emit('one',false)