|
1 | 1 | (function() { |
2 | | - var Bacon, BufferingSource, Bus, CompositeUnsubscribe, ConsumingSource, Desc, Dispatcher, End, Error, Event, EventStream, Exception, Initial, Next, None, Observable, Property, PropertyDispatcher, Some, Source, UpdateBarrier, _, addPropertyInitValueToStream, assert, assertArray, assertEventStream, assertFunction, assertNoArguments, assertObservable, assertString, cloneArray, constantToFunction, containsDuplicateDeps, convertArgsToFunction, describe, endEvent, eventIdCounter, eventMethods, findDeps, findHandlerMethods, flatMap_, former, idCounter, initialEvent, isArray, isFieldKey, isObservable, latter, liftCallback, makeFunction, makeFunctionArgs, makeFunction_, makeObservable, makeSpawner, nextEvent, nop, partiallyApplied, recursionDepth, ref, registerObs, spys, toCombinator, toEvent, toFieldExtractor, toFieldKey, toOption, toSimpleExtractor, valueAndEnd, withDescription, withMethodCallSupport, |
| 2 | + var Bacon, BufferingSource, Bus, CompositeUnsubscribe, ConsumingSource, Desc, Dispatcher, End, Error, Event, EventStream, Exception, Initial, Next, None, Observable, Property, PropertyDispatcher, Some, Source, UpdateBarrier, _, addPropertyInitValueToStream, assert, assertArray, assertEventStream, assertFunction, assertNoArguments, assertObservable, assertObservableIsProperty, assertString, cloneArray, constantToFunction, containsDuplicateDeps, convertArgsToFunction, describe, endEvent, eventIdCounter, eventMethods, findDeps, findHandlerMethods, flatMap_, former, idCounter, initialEvent, isArray, isFieldKey, isObservable, latter, liftCallback, makeFunction, makeFunctionArgs, makeFunction_, makeObservable, makeSpawner, nextEvent, nop, partiallyApplied, recursionDepth, ref, registerObs, spys, toCombinator, toEvent, toFieldExtractor, toFieldKey, toOption, toSimpleExtractor, valueAndEnd, withDescription, withMethodCallSupport, |
3 | 3 | hasProp = {}.hasOwnProperty, |
4 | 4 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, |
5 | 5 | slice = [].slice, |
|
11 | 11 | } |
12 | 12 | }; |
13 | 13 |
|
14 | | - Bacon.version = '0.7.53'; |
| 14 | + Bacon.version = '<version>'; |
15 | 15 |
|
16 | 16 | Exception = (typeof global !== "undefined" && global !== null ? global : this).Error; |
17 | 17 |
|
|
35 | 35 | } |
36 | 36 | }; |
37 | 37 |
|
| 38 | + assertObservableIsProperty = function(x) { |
| 39 | + if (x instanceof Observable && !(x instanceof Property)) { |
| 40 | + throw new Exception("Observable is not a Property : " + x); |
| 41 | + } |
| 42 | + }; |
| 43 | + |
38 | 44 | assertEventStream = function(event) { |
39 | 45 | if (!(event instanceof EventStream)) { |
40 | 46 | throw new Exception("not an EventStream : " + event); |
|
2155 | 2161 | Bacon.Observable.prototype.filter = function() { |
2156 | 2162 | var args, f; |
2157 | 2163 | f = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; |
| 2164 | + assertObservableIsProperty(f); |
2158 | 2165 | return convertArgsToFunction(this, f, args, function(f) { |
2159 | 2166 | return withDescription(this, "filter", f, this.withHandler(function(event) { |
2160 | 2167 | if (event.filter(f)) { |
|
2573 | 2580 | }; |
2574 | 2581 |
|
2575 | 2582 | Bus.prototype.push = function(value) { |
2576 | | - return typeof this.sink === "function" ? this.sink(nextEvent(value)) : void 0; |
| 2583 | + if (!this.ended) { |
| 2584 | + return typeof this.sink === "function" ? this.sink(nextEvent(value)) : void 0; |
| 2585 | + } |
2577 | 2586 | }; |
2578 | 2587 |
|
2579 | 2588 | Bus.prototype.error = function(error) { |
|
3104 | 3113 | Bacon.EventStream.prototype.skipWhile = function() { |
3105 | 3114 | var args, f, ok; |
3106 | 3115 | f = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; |
| 3116 | + assertObservableIsProperty(f); |
3107 | 3117 | ok = false; |
3108 | 3118 | return convertArgsToFunction(this, f, args, function(f) { |
3109 | 3119 | return withDescription(this, "skipWhile", f, this.withHandler(function(event) { |
|
3167 | 3177 | Bacon.Observable.prototype.takeWhile = function() { |
3168 | 3178 | var args, f; |
3169 | 3179 | f = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; |
| 3180 | + assertObservableIsProperty(f); |
3170 | 3181 | return convertArgsToFunction(this, f, args, function(f) { |
3171 | 3182 | return withDescription(this, "takeWhile", f, this.withHandler(function(event) { |
3172 | 3183 | if (event.filter(f)) { |
|
0 commit comments