This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var print = console.log.bind(console); | |
// partial implementation of Array.from | |
Array.from = function(iterable) { | |
var results = []; | |
for(var x of iterable) { | |
results.push(x); | |
} | |
return results; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Performs a exclusive waiting for the first to finish before subscribing to another observable. | |
* Observables that come in between subscriptions will be dropped on the floor. | |
* @returns {Observable} A exclusive observable with only the results that happen when subscribed. | |
*/ | |
observableProto.exclusive = function () { | |
var sources = this; | |
return new AnonymousObservable(function (observer) { | |
var hasCurrent = false, | |
isStopped = false, |