Skip to content

Instantly share code, notes, and snippets.

/*
* 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,
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;
};