UNPKG

asyncplify

Version:

FRP (functional reactive programming) library for Javascript

15 lines (13 loc) 364 B
Asyncplify.value = function (value) { return new Asyncplify(Value, value); }; function Value(value, sink) { this.sink = sink; this.sink.source = this; this.sink.emit(value); this.sink.end(null); } Value.prototype.setState = function (state) { if (state === Asyncplify.states.CLOSED) this.sink = NoopSink.instance; };