@@ -0,0 +1,1244 @@
1+var ControlStreamScheduler = require('../Control.Stream.Scheduler')
2+var ControlStreamStream = require('../Control.Stream.Stream')
4+exports.drain = function (stream) { return function () { return runSource(stream, ControlStreamScheduler.scheduler) } }
6+exports.subscribe = function (event) {
7+ return function (end) {
8+ return function (stream) {
10+ var disposable = new SettableDisposable()
12+ var observer = { event: event, end: end }
14+ var d = stream.run(observer)(ControlStreamScheduler.scheduler)
16+ disposable.setDisposable(d)
24+function runSource (source, scheduler) {
25+ var disposable = new SettableDisposable()
28+ return function (x) {
38+ var observer = { event: event, end: end }
40+ var d = source.run(observer)(scheduler)
42+ disposable.setDisposable(d)
47+var SettableDisposable = function SettableDisposable () {
48+ this.disposable = void 0
49+ this.disposed = false
53+SettableDisposable.prototype.setDisposable = function setDisposable (disposable) {
54+ this.disposable = disposable
57+ this.result = disposable.dispose()
61+SettableDisposable.prototype.dispose = function dispose () {
68+ if (this.disposable !== void 0) {
69+ this.result = this.disposable.dispose()
75+exports.fromArray = function (array) {
76+ return function (stream) {
77+ return new FromArray(array, stream)
81+function FromArray (array, stream) {
86+FromArray.prototype.run = function (sink) {
89+ return function (scheduler) {
90+ return that.stream.run(new FromArraySink(sink, that.array))(scheduler)
94+function FromArraySink (sink, array) {
99+FromArraySink.prototype.event = function (time) {
100+ var array = this.array
101+ var sink = this.sink
102+ return function (x) {
103+ var value = array.shift()
106+ sink.event(time)(value)
113+FromArraySink.prototype.end = function (time) {
117+var LinkedList = function LinkedList () {
122+LinkedList.prototype.add = function add (x) {
123+ if (this.head !== null) {
131+LinkedList.prototype.remove = function remove (x) { // eslint-disable-line complexity
133+ if (x === this.head) {
134+ this.head = this.head.next
136+ if (x.next !== null) {
137+ x.next.prev = x.prev
140+ if (x.prev !== null) {
141+ x.prev.next = x.next
146+LinkedList.prototype.isEmpty = function isEmpty () {
147+ return this.length === 0
150+LinkedList.prototype.dispose = function dispose () {
151+ if (this.isEmpty()) { return }
157+ while (x !== null) {
163+exports.chain = function (f) {
164+ return function (stream) {
165+ return mergeMapConcurrently(f)(Infinity)(stream)
169+exports.mergeConcurrently = mergeConcurrently
171+function mergeConcurrently (concurrency) {
172+ return function (stream) {
173+ return mergeMapConcurrently(function (x) { return x })(concurrency)(stream)
177+exports.join = mergeConcurrently(Infinity)
179+exports.mergeMapConcurrently = mergeMapConcurrently
181+function mergeMapConcurrently (f) {
182+ return function (concurrency) {
183+ return function (stream) {
184+ var mstream = new MergeConcurrently(f, concurrency, stream)
186+ mstream.run.bind(mstream)
193+function MergeConcurrently (f, concurrency, source) {
195+ this.concurrency = concurrency
196+ this.source = source
199+MergeConcurrently.prototype.run = function run (sink) {
202+ return function (scheduler) { return new Outer(this$1.f, this$1.concurrency, this$1.source, sink, scheduler) }
205+var Outer = function Outer (f, concurrency, source, sink, scheduler) {
207+ this.concurrency = concurrency
209+ this.scheduler = scheduler
211+ this.current = new LinkedList()
213+ var disposed = false
214+ var disposable = source.run(this)(scheduler)
217+ dispose: function () {
218+ if (disposed) return
221+ disposable.dispose()
228+Outer.prototype.event = function event (t) {
231+ return function (x) { return this$1._addInner(t, x) }
234+Outer.prototype._addInner = function _addInner (t, x) {
235+ if (this.current.length < this.concurrency) {
236+ this._startInner(t, x)
238+ this.pending.push(x)
242+Outer.prototype._startInner = function _startInner (t, x) {
243+ this._initInner(t, x)
246+Outer.prototype._initInner = function _initInner (t, x) {
247+ var innerSink = new Inner(t, this, this.sink)
248+ innerSink.disposable = mapAndRun(this.f, x, innerSink, this.scheduler)
249+ this.current.add(innerSink)
252+Outer.prototype.end = function end (t) {
254+ this.disposable.dispose()
258+Outer.prototype.dispose = function dispose () {
260+ this.pending.length = 0
261+ this.disposable.dispose()
262+ this.current.dispose()
265+Outer.prototype._endInner = function _endInner (t, inner) {
266+ this.current.remove(inner)
269+ if (this.pending.length === 0) {
272+ this._startInner(t, this.pending.shift())
276+Outer.prototype._checkEnd = function _checkEnd (t) {
277+ if (!this.active && this.current.isEmpty()) {
282+var mapAndRun = function (f, x, sink, scheduler) { return f(x).run(sink)(scheduler) }
284+var Inner = function Inner (time, outer, sink) {
285+ this.prev = this.next = null
289+ this.disposable = void 0
292+Inner.prototype.event = function event (t) {
295+ return function (x) { return this$1.sink.event(Math.max(t, this$1.time))(x) }
298+Inner.prototype.end = function end (t) {
299+ this.outer._endInner(Math.max(t, this.time), this)
302+Inner.prototype.dispose = function dispose () {
303+ return this.disposable.dispose()
306+exports.switch = function switchLatest (stream) {
307+ return new Switch(stream)
310+function Switch (source) {
311+ this.source = source
314+Switch.prototype.run = function (sink) {
317+ return function (scheduler) {
318+ var switchSink = new SwitchSink(sink, scheduler)
319+ var disposable = this$1.source.run(switchSink)(scheduler)
322+ dispose: function () {
323+ switchSink.dispose()
324+ disposable.dispose()
330+function SwitchSink (sink, scheduler) {
332+ this.scheduler = scheduler
337+SwitchSink.prototype.event = function (t) {
340+ return function (stream) {
341+ this$1._disposeCurrent(t) // TODO: capture the result of this dispose
342+ this$1.current = new Segment(t, Infinity, this$1, this$1.sink)
343+ this$1.current.disposable = stream.run(this$1.current)(this$1.scheduler)
347+SwitchSink.prototype.end = function (t, x) {
349+ this._checkEnd(t, x)
352+SwitchSink.prototype.dispose = function () {
353+ return this._disposeCurrent(this.scheduler.now())
356+SwitchSink.prototype._disposeCurrent = function (t) {
357+ if (this.current !== null) {
358+ return this.current._dispose(t)
362+SwitchSink.prototype._disposeInner = function (t, inner) {
363+ inner._dispose(t) // TODO: capture the result of this dispose
364+ if (inner === this.current) {
369+SwitchSink.prototype._checkEnd = function (t, x) {
370+ if (this.ended && this.current === null) {
375+SwitchSink.prototype._endInner = function (t, x, inner) {
376+ this._disposeInner(t, inner)
377+ this._checkEnd(t, x)
380+function Segment (min, max, outer, sink) {
385+ this.disposable = { dispose: Function.prototype }
388+Segment.prototype.event = function (t) {
391+ return function (x) {
392+ if (t < this$1.max) {
393+ this$1.sink.event(Math.max(t, this$1.min))(x)
398+Segment.prototype.end = function (t, x) {
399+ this.outer._endInner(Math.max(t, this.min), x, this)
402+Segment.prototype._dispose = function (t) {
404+ this.disposable.dispose()
407+exports.continueWith = function continueWith (f) {
408+ return function (stream) {
409+ return new ContinueWith(f, stream)
413+function ContinueWith (f, source) {
415+ this.source = source
418+ContinueWith.prototype.run = function (sink) {
420+ return function (scheduler) {
421+ return new ContinueWithSink(that.f, that.source, sink, scheduler)
425+function ContinueWithSink (f, source, sink, scheduler) {
428+ this.scheduler = scheduler
430+ this.disposable = source.run(this)(scheduler)
433+ContinueWithSink.prototype.event = function (t) {
436+ return function (x) {
440+ that.sink.event(t)(x)
444+ContinueWithSink.prototype.end = function (t, x) {
449+ this.disposable.dispose()
451+ this._startNext(t, x, this.sink)
454+ContinueWithSink.prototype._startNext = function (t, x, sink) {
456+ this.disposable = this._continue(this.f, x, sink)
462+ContinueWithSink.prototype._continue = function (f, x, sink) {
463+ return f(x).run(sink)(this.scheduler)
466+ContinueWithSink.prototype.dispose = function () {
468+ return this.disposable.dispose()
471+exports.combine2 = function (f) { return function (s1) { return function (s2) { return combineArray(f, [s1, s2]) } } }
472+exports.combine3 = function (f) { return function (s1) { return function (s2) { return function (s3) { return combineArray(f, [s1, s2, s3]) } } } }
473+exports.combine4 = function (f) { return function (s1) { return function (s2) { return function (s3) { return function (s4) { return combineArray(f, [s1, s2, s3, s4]) } } } } }
474+exports.combine5 = function (f) { return function (s1) { return function (s2) { return function (s3) { return function (s4) { return function (s5) { return combineArray(f, [s1, s2, s3, s4, s5]) } } } } } }
476+exports.combineArray = function (streams) {
477+ return combineArray(Array, streams)
480+function combineArray (f, streams) {
481+ return new Combine(f, streams)
484+function Combine (f, sources) {
486+ this.sources = sources
489+Combine.prototype.run = function (sink) {
492+ return function (scheduler) {
493+ var l = this$1.sources.length
494+ var disposables = new Array(l)
495+ var sinks = new Array(l)
497+ var mergeSink = new CombineSink(disposables, sinks, sink, this$1.f)
499+ for (var indexSink, i = 0; i < l; ++i) {
500+ indexSink = sinks[i] = new IndexSink(i, mergeSink)
501+ disposables[i] = this$1.sources[i].run(indexSink)(scheduler)
505+ dispose: function () {
506+ disposables.forEach(function (d) {
514+function CombineSink (disposables, sinks, sink, f) {
518+ this.disposables = disposables
522+ var l = sinks.length
524+ this.values = new Array(l)
525+ this.hasValue = new Array(l)
527+ for (var i = 0; i < l; ++i) {
528+ this$1.hasValue[i] = false
531+ this.activeCount = sinks.length
534+CombineSink.prototype.event = function (t) {
537+ return function (indexedValue) {
538+ var i = indexedValue.index
539+ var awaiting = this$1._updateReady(i)
541+ this$1.values[i] = indexedValue.value
542+ if (awaiting === 0) {
543+ var value = tail(this$1.values).reduce(function (f, x) { return f(x) }, this$1.f(this$1.values[0]))
544+ this$1.sink.event(t)(value)
549+CombineSink.prototype._updateReady = function (index) {
550+ if (this.awaiting > 0) {
551+ if (!this.hasValue[index]) {
552+ this.hasValue[index] = true
556+ return this.awaiting
559+CombineSink.prototype.end = function (t, indexedValue) {
560+ this.disposables[indexedValue.index].dispose()
562+ if (--this.activeCount === 0) {
567+var IndexSink = function IndexSink (i, sink) {
574+IndexSink.prototype.event = function event (t) {
577+ return function (x) {
578+ if (!this$1.active) { return }
581+ this$1.sink.event(t)(this$1)
585+IndexSink.prototype.end = function end (t) {
586+ if (!this.active) { return }
589+ this.sink.end(t, { index: this.index })
592+function drop (n, a) { // eslint-disable-line complexity
594+ throw new TypeError('n must be >= 0')
598+ if (n === 0 || l === 0) {
606+ return unsafeDrop(n, a, l - n)
609+// unsafeDrop :: Int -> [a] -> Int -> [a]
610+// Internal helper for drop
611+function unsafeDrop (n, a, l) {
612+ var b = new Array(l)
613+ for (var i = 0; i < l; ++i) {
619+// tail :: [a] -> [a]
625+exports.merge = function merge (streams) {
626+ return mergeSources(streams)
630+ * This implements fusion/flattening for merge. It will
631+ * fuse adjacent merge operations. For example:
632+ * - a.merge(b).merge(c) effectively becomes merge(a, b, c)
633+ * - merge(a, merge(b, c)) effectively becomes merge(a, b, c)
634+ * It does this by concatenating the sources arrays of
635+ * any nested Merge sources, in effect "flattening" nested
636+ * merge operations into a single merge.
638+function mergeSources (streams) {
639+ return new Merge(reduce(appendSources, [], streams))
642+function appendSources (sources, stream) {
643+ return stream instanceof Merge
644+ ? sources.concat(stream.sources)
645+ : sources.concat(stream)
648+function Merge (sources) {
649+ this.sources = sources
652+Merge.prototype.run = function (sink) {
655+ return function (scheduler) {
656+ var l = this.sources.length
657+ var disposables = new Array(l)
658+ var sinks = new Array(l)
660+ var mergeSink = new MergeSink(disposables, sinks, sink)
662+ for (var indexSink, i = 0; i < l; ++i) {
663+ indexSink = sinks[i] = new IndexSink(i, mergeSink)
664+ disposables[i] = this$1.sources[i].run(indexSink, scheduler)
667+ return all(disposables)
671+function all (disposables) {
673+ dispose: function () {
674+ disposables.forEach(function (d) {
681+function MergeSink (disposables, sinks, sink) {
683+ this.disposables = disposables
684+ this.activeCount = sinks.length
687+MergeSink.prototype.event = function (t) {
689+ return function (indexValue) {
690+ that.sink.event(t)(indexValue.value)
694+MergeSink.prototype.end = function (t, indexedValue) {
695+ this.disposables[indexedValue.index].dispose()
696+ if (--this.activeCount === 0) {
697+ this.sink.end(t, indexedValue.value)
701+function reduce (f, z, a) {
703+ for (var i = 0, l = a.length; i < l; ++i) {
709+exports.until = function takeUntil (signal) {
710+ return function (stream) {
711+ return new Until(signal, stream)
715+exports.since = function skipUntil (signal) {
716+ return function (stream) {
717+ return new Since(signal, stream)
721+function Until (maxSignal, source) {
722+ this.maxSignal = maxSignal
723+ this.source = source
726+Until.prototype.run = function (sink) {
728+ return function (scheduler) {
729+ var min = new Bound(-Infinity, sink)
730+ var max = new UpperBound(that.maxSignal, sink, scheduler)
731+ var disposable = that.source.run(new TimeWindowSink(min, max, sink), scheduler)
733+ return all([min, max, disposable])
737+function Since (minSignal, source) {
738+ this.minSignal = minSignal
739+ this.source = source
742+Since.prototype.run = function (sink) {
744+ return function (scheduler) {
745+ var min = new LowerBound(that.minSignal, sink, scheduler)
746+ var max = new Bound(Infinity, sink)
747+ var disposable = that.source.run(new TimeWindowSink(min, max, sink))(scheduler)
749+ return all([min, max, disposable])
753+function Bound (value, sink) {
758+Bound.prototype.event = noop
759+Bound.prototype.end = noop
760+Bound.prototype.dispose = noop
762+function TimeWindowSink (min, max, sink) {
768+TimeWindowSink.prototype.event = function (t, x) {
770+ return function (x) {
771+ if (t >= that.min.value && t < that.max.value) {
772+ that.sink.event(t)(x)
777+TimeWindowSink.prototype.end = function (time) {
781+function LowerBound (signal, sink, scheduler) {
782+ this.value = Infinity
784+ this.disposable = signal.run(this)(scheduler)
787+LowerBound.prototype.event = function (t /*, x */) {
788+ return function () {
789+ if (t < this.value) {
795+LowerBound.prototype.end = noop
797+LowerBound.prototype.dispose = function () {
798+ return this.disposable.dispose()
801+function UpperBound (signal, sink, scheduler) {
802+ this.value = Infinity
804+ this.disposable = signal.run(this)(scheduler)
807+UpperBound.prototype.event = function (t) {
810+ return function (x) {
811+ if (t < this.value) {
818+UpperBound.prototype.end = noop
820+UpperBound.prototype.dispose = function () {
821+ return this.disposable.dispose()
826+exports.throttle = function throttle (period) {
827+ return function (stream) {
828+ return throttleSource(period, stream)
832+function throttleSource (period, source) {
833+ return source instanceof Throttle
834+ ? fuseThrottle(period, source)
835+ : new Throttle(period, source)
838+function fuseThrottle (period, source) {
839+ return new Throttle(Math.max(period, source.period), source.source)
842+function Throttle (period, source) {
843+ this.period = period
844+ this.source = source
847+Throttle.prototype.run = function (sink) {
849+ return function (scheduler) {
850+ return that.source.run(new ThrottleSink(that.period, sink), scheduler)
854+function ThrottleSink (period, sink) {
856+ this.period = period
860+ThrottleSink.prototype.event = function (t) {
862+ return function (x) {
863+ if (t >= this.time) {
864+ that.time = t + this.period
865+ that.sink.event(t)(x)
870+ThrottleSink.prototype.end = function (t) { this.sink.end(t) }
872+exports.debounce = function debounce (period) {
873+ return function (stream) {
874+ return new Debounce(period, stream)
878+function Debounce (dt, source) {
880+ this.source = source
883+Debounce.prototype.run = function (sink) {
885+ return function (scheduler) {
886+ return new DebounceSink(that.dt, that.source, sink, scheduler)
890+function DebounceSink (dt, source, sink, scheduler) {
893+ this.scheduler = scheduler
897+ var sourceDisposable = source.run(this)(scheduler)
898+ this.disposable = all([this, sourceDisposable])
901+DebounceSink.prototype.event = function (t) {
903+ return function (x) {
906+ var task = ControlStreamScheduler.eventTask(that.sink)(x)
907+ that.timer = this.scheduler.delay(this.dt, task)
911+DebounceSink.prototype.end = function (t, x) {
912+ if (this._clearTimer()) {
913+ this.sink.event(t, this.value)
919+DebounceSink.prototype.dispose = function () {
923+DebounceSink.prototype._clearTimer = function () {
924+ if (this.timer === null) {
927+ this.timer.dispose()
932+exports.delay = function delay (delayTime) {
933+ return function (stream) {
934+ return delayTime <= 0 ? stream : new Delay(delayTime, stream)
938+function Delay (dt, source) {
940+ this.source = source
943+Delay.prototype.run = function (sink) {
946+ return function (scheduler) {
947+ var delaySink = new DelaySink(that.dt, sink, scheduler)
948+ return all([delaySink, that.source.run(delaySink)(scheduler)])
952+function DelaySink (dt, sink, scheduler) {
955+ this.scheduler = scheduler
958+DelaySink.prototype.dispose = function () {
960+ this.scheduler.cancelAll(function (task) {
961+ return task.sink === self.sink
965+DelaySink.prototype.event = function (t) {
967+ return function (x) {
968+ that.scheduler.delay(that.dt)(ControlStreamScheduler.eventTask(that.sink)(x))
972+DelaySink.prototype.end = function (t, x) {
973+ this.scheduler.delay(this.dt)(ControlStreamScheduler.endTask(this.sink))
976+var MulticastDisposable = function MulticastDisposable (source, sink) {
977+ this.source = source
979+ this.disposed = false
982+MulticastDisposable.prototype.dispose = function dispose () {
983+ if (this.disposed) {
986+ this.disposed = true
987+ var remaining = this.source.remove(this.sink)
988+ return remaining === 0 && this.source._dispose()
991+var dispose = function (disposable) { return disposable.dispose() }
993+var emptyDisposable = {
994+ dispose: function dispose$1 () { }
997+function MulticastSource (source) {
998+ this.source = source
1000+ this._disposable = emptyDisposable
1003+MulticastSource.prototype.run = function run (sink) {
1005+ return function (scheduler) {
1006+ var n = that.add(sink)
1008+ that._disposable = that.source.run(that)(scheduler)
1010+ return new MulticastDisposable(that, sink)
1014+MulticastSource.prototype._dispose = function _dispose () {
1015+ var disposable = this._disposable
1016+ this._disposable = emptyDisposable
1017+ return Promise.resolve(disposable).then(dispose)
1020+MulticastSource.prototype.add = function add (sink) {
1021+ this.sinks = append(sink, this.sinks)
1022+ return this.sinks.length
1025+function append (x, a) {
1027+ var b = new Array(l + 1)
1028+ for (var i = 0; i < l; ++i) {
1036+MulticastSource.prototype.remove = function remove$1 (sink) {
1037+ var i = findIndex(sink, this.sinks)
1038+ // istanbul ignore next
1040+ this.sinks = remove(i, this.sinks)
1043+ return this.sinks.length
1046+function findIndex (x, a) {
1047+ for (var i = 0, l = a.length; i < l; ++i) {
1055+function remove (i, a) { // eslint-disable-line complexity
1057+ throw new TypeError('i must be >= 0')
1061+ if (l === 0 || i >= l) { // exit early if index beyond end of array
1065+ if (l === 1) { // exit early if index in bounds and length === 1
1069+ return unsafeRemove(i, a, l - 1)
1072+// unsafeRemove :: Int -> [a] -> Int -> [a]
1073+// Internal helper to remove element at index
1074+function unsafeRemove (i, a, l) {
1075+ var b = new Array(l)
1077+ for (j = 0; j < i; ++j) {
1080+ for (j = i; j < l; ++j) {
1087+MulticastSource.prototype.event = function event (time) {
1089+ return function (value) {
1091+ if (s.length === 1) {
1092+ return s[0].event(time)(value)
1094+ for (var i = 0; i < s.length; ++i) {
1095+ s[i].event(time)(value)
1100+MulticastSource.prototype.end = function end (time) {
1102+ for (var i = 0; i < s.length; ++i) {
1107+MulticastSource.prototype.until = function (signal) {
1108+ return exports.until(signal)(this)
1111+exports.multicast = function multicast (stream) {
1112+ return new MulticastSource(stream)
1115+function __extends (d, b) { // eslint-disable-line complexity
1116+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]
1117+ function __ () { this.constructor = d }
1118+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __())
1121+var HoldSubjectSource = (function (_super) {
1122+ __extends(HoldSubjectSource, _super)
1123+ function HoldSubjectSource (source, bufferSize) {
1124+ var _this = _super.call(this, source) || this
1127+ _this.bufferSize = bufferSize
1130+ HoldSubjectSource.prototype.add = function (sink) {
1132+ pushEvents(this.buffer, sink)
1134+ return _super.prototype.add.call(this, sink)
1136+ HoldSubjectSource.prototype.event = function (time) {
1138+ return function (value) {
1140+ that.buffer = dropAndAppend(value, that.buffer, that.bufferSize)
1141+ return _super.prototype.event.call(that, time)(value)
1144+ return HoldSubjectSource
1147+function pushEvents (buffer, sink) {
1148+ var length = buffer.length
1149+ for (var i = 0; i < length; ++i) {
1150+ sink.event(ControlStreamScheduler.scheduler.now(), buffer[i])
1154+function dropAndAppend (value, buffer, bufferSize) {
1155+ if (buffer.length === bufferSize) {
1156+ return append(value, drop(1, buffer))
1158+ return append(value, buffer)
1161+exports.hold = function hold (bufferSize) {
1162+ return function (stream) {
1163+ return new HoldSubjectSource(stream, bufferSize)
1167+exports.toSubject = function (stream) {
1168+ return exports.multicast(stream)
1171+exports.toHoldSubject = exports.hold
1173+exports.fromSubject = function (subject) {
1177+exports.subjectEvent = function (value) {
1178+ return function (subject) {
1179+ ControlStreamScheduler.eventTask(subject)(value)
1184+exports.subjectEnd = function (value) {
1185+ return function (subject) {
1186+ subject.end(Date.now())
1191+exports.proxy = function (value) {
1192+ var stream = new ProxyStream(value)
1194+ function attach (original) {
1195+ stream.attach(original)
1199+ return { attach: attach, stream: stream }
1202+var ProxyStream = (function (_super) {
1203+ __extends(ProxyStream, _super)
1204+ function ProxyStream (value) {
1205+ var _this = _super.call(this, ControlStreamStream.never, 1) || this
1206+ _this.attached = false
1207+ _this.running = false
1208+ _this.buffer.push(value)
1211+ ProxyStream.prototype.run = function (sink) {
1216+ return function (scheduler) {
1217+ if (that.attached && !that.running) {
1218+ that.running = true
1219+ that._disposable = that.source.run(that)(scheduler)
1220+ return that._disposable
1223+ return new MulticastDisposable(that, sink)
1227+ ProxyStream.prototype.attach = function (source) {
1228+ if (this.attached) throw new Error('Can only proxy 1 stream')
1229+ this.attached = true
1231+ this.source = source
1233+ if (this.sinks.length) { this._disposable = source.run(this)(ControlStreamScheduler.scheduler) }
1236+ ProxyStream.prototype.end = function end (time) {
1237+ this.attached = false
1238+ this.running = false
1240+ return _super.prototype.end.call(this, time)
1244+}(HoldSubjectSource))