Socket
Socket
Sign inDemoInstall

rx

Package Overview
Dependencies
0
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.0.1

code-of-conduct.md

138

dist/rx.async.compat.js

@@ -66,3 +66,12 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

var spawn = Observable.spawn = function () {
var wrap = Observable.wrap = function (fn) {
createObservable.__generatorFunction__ = fn;
return createObservable;
function createObservable() {
return Observable.spawn.call(this, fn.apply(this, arguments));
}
};
var spawn = Observable.spawn = function () {
var gen = arguments[0], self = this, args = [];

@@ -98,2 +107,3 @@ for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }

o.onCompleted();
return;
}

@@ -112,74 +122,73 @@ var value = toObservable.call(self, ret.value);

function toObservable(obj) {
if (!obj) { return obj; }
if (Observable.isObservable(obj)) { return obj; }
if (isPromise(obj)) { return Observable.fromPromise(obj); }
if (isGeneratorFunction(obj) || isGenerator(obj)) { return spawn.call(this, obj); }
if (isFunction(obj)) { return thunkToObservable.call(this, obj); }
if (isArrayLike(obj) || isIterable(obj)) { return arrayToObservable.call(this, obj); }
if (isObject(obj)) return objectToObservable.call(this, obj);
return obj;
}
function toObservable(obj) {
if (!obj) { return obj; }
if (Observable.isObservable(obj)) { return obj; }
if (isPromise(obj)) { return Observable.fromPromise(obj); }
if (isGeneratorFunction(obj) || isGenerator(obj)) { return spawn.call(this, obj); }
if (isFunction(obj)) { return thunkToObservable.call(this, obj); }
if (isArrayLike(obj) || isIterable(obj)) { return arrayToObservable.call(this, obj); }
if (isObject(obj)) {return objectToObservable.call(this, obj);}
return obj;
}
function arrayToObservable (obj) {
return Observable.from(obj)
.map(toObservable, this)
function arrayToObservable (obj) {
return Observable.from(obj)
.flatMap(toObservable)
.toArray();
}
}
function objectToObservable (obj) {
var results = new obj.constructor(), keys = Object.keys(obj), observables = [];
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i], observable = toObservable.call(this, obj[key]);
if (observable && Observable.isObservable(observable)) {
defer(observable, key);
} else {
results[key] = obj[key];
}
}
return Observable.concat(observables).startWith(results);
function objectToObservable (obj) {
var results = new obj.constructor(), keys = Object.keys(obj), observables = [];
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i];
var observable = toObservable.call(this, obj[key]);
function defer (observable, key) {
results[key] = undefined;
observables.push(new AnonymousObservable(function (o) {
return observable.subscribe(function (next) {
results[key] = next;
o.onCompleted();
});
}));
if(observable && Observable.isObservable(observable)) {
defer(observable, key);
} else {
results[key] = obj[key];
}
}
function thunkToObservable(fn) {
var self = this;
return new AnonymousObservable(function (o) {
fn.call(self, function () {
var err = arguments[0], res = arguments[1];
if (err) { return o.onError(err); }
if (arguments.length > 2) {
var args = [];
for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
res = args;
}
o.onNext(res);
o.onCompleted();
});
});
}
return Observable.forkJoin.apply(Observable, observables).map(function() {
return results;
});
function isGenerator(obj) {
return isFunction (obj.next) && isFunction (obj.throw);
}
function isGeneratorFunction(obj) {
var ctor = obj.constructor;
if (!ctor) { return false; }
if (ctor.name === 'GeneratorFunction' || ctor.displayName === 'GeneratorFunction') { return true; }
return isGenerator(ctor.prototype);
function defer (observable, key) {
results[key] = undefined;
observables.push(observable.map(function (next) {
results[key] = next;
}));
}
}
function isObject(val) {
return Object == val.constructor;
}
function thunkToObservable(fn) {
var self = this;
return new AnonymousObservable(function (o) {
fn.call(self, function () {
var err = arguments[0], res = arguments[1];
if (err) { return o.onError(err); }
if (arguments.length > 2) {
var args = [];
for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
res = args;
}
o.onNext(res);
o.onCompleted();
});
});
}
function isGenerator(obj) {
return isFunction (obj.next) && isFunction (obj.throw);
}
function isGeneratorFunction(obj) {
var ctor = obj.constructor;
if (!ctor) { return false; }
if (ctor.name === 'GeneratorFunction' || ctor.displayName === 'GeneratorFunction') { return true; }
return isGenerator(ctor.prototype);
}
/**

@@ -274,2 +283,4 @@ * Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.

return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len)

@@ -323,2 +334,3 @@ for(var i = 0; i < len; i++) { args[i] = arguments[i]; }

return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len);

@@ -509,5 +521,7 @@ for(var i = 0; i < len; i++) { args[i] = arguments[i]; }

* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @param {Scheduler} [scheduler] A scheduler used to schedule the remove handler.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (o) {

@@ -514,0 +528,0 @@ function innerHandler () {

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"function":!0,object:!0},c=b[typeof exports]&&exports&&!exports.nodeType&&exports,d=b[typeof self]&&self.Object&&self,e=b[typeof window]&&window&&window.Object&&window,f=b[typeof module]&&module&&!module.nodeType&&module,g=(f&&f.exports===c&&c,c&&f&&"object"==typeof global&&global&&global.Object&&global),h=h=g||e!==(this&&this.window)&&e||d||this;"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,c){return h.Rx=a(h,c,b),h.Rx}):"object"==typeof module&&module&&module.exports===c?module.exports=a(h,module.exports,require("./rx")):h.Rx=a(h,{},h.Rx)}).call(this,function(a,b,c,d){function e(){try{return y.apply(this,arguments)}catch(a){return K.e=a,K}}function f(a){if(!J(a))throw new TypeError("fn must be a function");return y=a,e}function g(a){return a?z.isObservable(a)?a:I(a)?z.fromPromise(a):l(a)||k(a)?L.call(this,a):J(a)?j.call(this,a):isArrayLike(a)||isIterable(a)?h.call(this,a):m(a)?i.call(this,a):a:a}function h(a){return z.from(a).map(g,this).toArray()}function i(a){function b(a,b){c[b]=d,f.push(new C(function(d){return a.subscribe(function(a){c[b]=a,d.onCompleted()})}))}for(var c=new a.constructor,e=Object.keys(a),f=[],h=0,i=e.length;i>h;h++){var j=e[h],k=g.call(this,a[j]);k&&z.isObservable(k)?b(k,j):c[j]=a[j]}return z.concat(f).startWith(c)}function j(a){var b=this;return new C(function(c){a.call(b,function(){var a=arguments[0],b=arguments[1];if(a)return c.onError(a);if(arguments.length>2){for(var d=[],e=1,f=arguments.length;f>e;e++)d.push(arguments[e]);b=d}c.onNext(b),c.onCompleted()})})}function k(a){return J(a.next)&&J(a["throw"])}function l(a){var b=a.constructor;return b?"GeneratorFunction"===b.name||"GeneratorFunction"===b.displayName?!0:k(b.prototype):!1}function m(a){return Object==a.constructor}function n(a,b,c,d){var e=new D;return d.push(o(e,b,c)),a.apply(b,d),e.asObservable()}function o(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),g=0;d>g;g++)e[g]=arguments[g];if(J(c)){if(e=f(c).apply(b,e),e===K)return a.onError(e.e);a.onNext(e)}else e.length<=1?a.onNext(e[0]):a.onNext(e);a.onCompleted()}}function p(a,b,c,d){var e=new D;return d.push(q(e,b,c)),a.apply(b,d),e.asObservable()}function q(a,b,c){return function(){var d=arguments[0];if(d)return a.onError(d);for(var e=arguments.length,g=[],h=1;e>h;h++)g[h-1]=arguments[h];if(J(c)){var g=f(c).apply(b,g);if(g===K)return a.onError(g.e);a.onNext(g)}else g.length<=1?a.onNext(g[0]):a.onNext(g);a.onCompleted()}}function r(a){return window.StaticNodeList?a instanceof window.StaticNodeList||a instanceof window.NodeList:"[object NodeList]"==Object.prototype.toString.call(a)}function s(b){var c=function(){this.cancelBubble=!0},d=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(b||(b=a.event),!b.target)switch(b.target=b.target||b.srcElement,"mouseover"==b.type&&(b.relatedTarget=b.fromElement),"mouseout"==b.type&&(b.relatedTarget=b.toElement),b.stopPropagation||(b.stopPropagation=c,b.preventDefault=d),b.type){case"keypress":var e="charCode"in b?b.charCode:b.keyCode;10==e?(e=0,b.keyCode=13):13==e||27==e?e=0:3==e&&(e=99),b.charCode=e,b.keyChar=b.charCode?String.fromCharCode(b.charCode):""}return b}function t(a,b,c){this._e=a,this._n=b,this._fn=c,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function u(a,b,c){this._e=a,this._n="on"+b,this._fn=function(a){c(s(a))},this._e.attachEvent(this._n,this._fn),this.isDisposed=!1}function v(a,b,c){this._e=a,this._n="on"+b,this._e[this._n]=c,this.isDisposed=!1}function w(a,b,c){return a.addEventListener?new t(a,b,c):a.attachEvent?new u(a,b,c):v(a,b,c)}function x(a,b,c){var d=new F;if(r(a)||"[object HTMLCollection]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(x(a.item(e),b,c));else a&&d.add(w(a,b,c));return d}var y,z=c.Observable,A=(z.prototype,z.fromPromise),B=z.throwError,C=c.AnonymousObservable,D=c.AsyncSubject,E=c.Disposable.create,F=c.CompositeDisposable,G=(c.Scheduler.immediate,c.Scheduler["default"]),H=c.Scheduler.isScheduler,I=c.helpers.isPromise,J=c.helpers.isFunction,K={e:{}},L=z.spawn=function(){for(var a=arguments[0],b=this,c=[],d=1,e=arguments.length;e>d;d++)c.push(arguments[d]);return new C(function(d){function e(b){var c=f(a.next).call(a,b);return c===K?d.onError(c.e):void i(c)}function h(b){var c=f(a.next).call(a,b);return c===K?d.onError(c.e):void i(c)}function i(a){a.done&&(d.onNext(a.value),d.onCompleted());var c=g.call(b,a.value);z.isObservable(c)?j.add(c.subscribe(e,h)):h(new TypeError("type not supported"))}var j=new F;return J(a)&&(a=a.apply(b,c)),a&&J(a.next)?(e(),j):(d.onNext(a),d.onCompleted())})};z.start=function(a,b,c){return M(a,b,c)()};var M=z.toAsync=function(a,b,c){return H(c)||(c=G),function(){var d=arguments,e=new D;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};z.fromCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return n(a,b,c,e)}},z.fromNodeCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return p(a,b,c,e)}},t.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},u.prototype.dispose=function(){this.isDisposed||(this._e.detachEvent(this._n,this._fn),this.isDisposed=!0)},v.prototype.dispose=function(){this.isDisposed||(this._e[this._n]=null,this.isDisposed=!0)},c.config.useNativeEvents=!1,z.fromEvent=function(a,b,d){return a.addListener?N(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new C(function(c){return x(a,b,function(){var a=arguments[0];return J(d)&&(a=f(d).apply(null,arguments),a===K)?c.onError(a.e):void c.onNext(a)})}).publish().refCount():N(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var N=z.fromEventPattern=function(a,b,c){return new C(function(d){function e(){var a=arguments[0];return J(c)&&(a=f(c).apply(null,arguments),a===K)?d.onError(a.e):void d.onNext(a)}var g=a(e);return E(function(){J(b)&&b(e,g)})}).publish().refCount()};return z.startAsync=function(a){var b;try{b=a()}catch(c){return B(c)}return A(b)},c});
(function(a){var b={"function":!0,object:!0},c=b[typeof exports]&&exports&&!exports.nodeType&&exports,d=b[typeof self]&&self.Object&&self,e=b[typeof window]&&window&&window.Object&&window,f=b[typeof module]&&module&&!module.nodeType&&module,g=(f&&f.exports===c&&c,c&&f&&"object"==typeof global&&global&&global.Object&&global),h=h=g||e!==(this&&this.window)&&e||d||this;"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,c){return h.Rx=a(h,c,b),h.Rx}):"object"==typeof module&&module&&module.exports===c?module.exports=a(h,module.exports,require("./rx")):h.Rx=a(h,{},h.Rx)}).call(this,function(a,b,c,d){function e(){try{return x.apply(this,arguments)}catch(a){return K.e=a,K}}function f(a){if(!J(a))throw new TypeError("fn must be a function");return x=a,e}function g(a){return a?y.isObservable(a)?a:I(a)?y.fromPromise(a):l(a)||k(a)?L.call(this,a):J(a)?j.call(this,a):isArrayLike(a)||isIterable(a)?h.call(this,a):isObject(a)?i.call(this,a):a:a}function h(a){return y.from(a).flatMap(g).toArray()}function i(a){function b(a,b){c[b]=d,f.push(a.map(function(a){c[b]=a}))}for(var c=new a.constructor,e=Object.keys(a),f=[],h=0,i=e.length;i>h;h++){var j=e[h],k=g.call(this,a[j]);k&&y.isObservable(k)?b(k,j):c[j]=a[j]}return y.forkJoin.apply(y,f).map(function(){return c})}function j(a){var b=this;return new B(function(c){a.call(b,function(){var a=arguments[0],b=arguments[1];if(a)return c.onError(a);if(arguments.length>2){for(var d=[],e=1,f=arguments.length;f>e;e++)d.push(arguments[e]);b=d}c.onNext(b),c.onCompleted()})})}function k(a){return J(a.next)&&J(a["throw"])}function l(a){var b=a.constructor;return b?"GeneratorFunction"===b.name||"GeneratorFunction"===b.displayName?!0:k(b.prototype):!1}function m(a,b,c,d){var e=new C;return d.push(n(e,b,c)),a.apply(b,d),e.asObservable()}function n(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),g=0;d>g;g++)e[g]=arguments[g];if(J(c)){if(e=f(c).apply(b,e),e===K)return a.onError(e.e);a.onNext(e)}else e.length<=1?a.onNext(e[0]):a.onNext(e);a.onCompleted()}}function o(a,b,c,d){var e=new C;return d.push(p(e,b,c)),a.apply(b,d),e.asObservable()}function p(a,b,c){return function(){var d=arguments[0];if(d)return a.onError(d);for(var e=arguments.length,g=[],h=1;e>h;h++)g[h-1]=arguments[h];if(J(c)){var g=f(c).apply(b,g);if(g===K)return a.onError(g.e);a.onNext(g)}else g.length<=1?a.onNext(g[0]):a.onNext(g);a.onCompleted()}}function q(a){return window.StaticNodeList?a instanceof window.StaticNodeList||a instanceof window.NodeList:"[object NodeList]"==Object.prototype.toString.call(a)}function r(b){var c=function(){this.cancelBubble=!0},d=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(b||(b=a.event),!b.target)switch(b.target=b.target||b.srcElement,"mouseover"==b.type&&(b.relatedTarget=b.fromElement),"mouseout"==b.type&&(b.relatedTarget=b.toElement),b.stopPropagation||(b.stopPropagation=c,b.preventDefault=d),b.type){case"keypress":var e="charCode"in b?b.charCode:b.keyCode;10==e?(e=0,b.keyCode=13):13==e||27==e?e=0:3==e&&(e=99),b.charCode=e,b.keyChar=b.charCode?String.fromCharCode(b.charCode):""}return b}function s(a,b,c){this._e=a,this._n=b,this._fn=c,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function t(a,b,c){this._e=a,this._n="on"+b,this._fn=function(a){c(r(a))},this._e.attachEvent(this._n,this._fn),this.isDisposed=!1}function u(a,b,c){this._e=a,this._n="on"+b,this._e[this._n]=c,this.isDisposed=!1}function v(a,b,c){return a.addEventListener?new s(a,b,c):a.attachEvent?new t(a,b,c):u(a,b,c)}function w(a,b,c){var d=new E;if(q(a)||"[object HTMLCollection]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(w(a.item(e),b,c));else a&&d.add(v(a,b,c));return d}var x,y=c.Observable,z=(y.prototype,y.fromPromise),A=y.throwError,B=c.AnonymousObservable,C=c.AsyncSubject,D=c.Disposable.create,E=c.CompositeDisposable,F=c.Scheduler.immediate,G=c.Scheduler["default"],H=c.Scheduler.isScheduler,I=c.helpers.isPromise,J=c.helpers.isFunction,K={e:{}},L=(y.wrap=function(a){function b(){return y.spawn.call(this,a.apply(this,arguments))}return b.__generatorFunction__=a,b},y.spawn=function(){for(var a=arguments[0],b=this,c=[],d=1,e=arguments.length;e>d;d++)c.push(arguments[d]);return new B(function(d){function e(b){var c=f(a.next).call(a,b);return c===K?d.onError(c.e):void i(c)}function h(b){var c=f(a.next).call(a,b);return c===K?d.onError(c.e):void i(c)}function i(a){if(a.done)return d.onNext(a.value),void d.onCompleted();var c=g.call(b,a.value);y.isObservable(c)?j.add(c.subscribe(e,h)):h(new TypeError("type not supported"))}var j=new E;return J(a)&&(a=a.apply(b,c)),a&&J(a.next)?(e(),j):(d.onNext(a),d.onCompleted())})});y.start=function(a,b,c){return M(a,b,c)()};var M=y.toAsync=function(a,b,c){return H(c)||(c=G),function(){var d=arguments,e=new C;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};y.fromCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return m(a,b,c,e)}},y.fromNodeCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return o(a,b,c,e)}},s.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},t.prototype.dispose=function(){this.isDisposed||(this._e.detachEvent(this._n,this._fn),this.isDisposed=!0)},u.prototype.dispose=function(){this.isDisposed||(this._e[this._n]=null,this.isDisposed=!0)},c.config.useNativeEvents=!1,y.fromEvent=function(a,b,d){return a.addListener?N(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new B(function(c){return w(a,b,function(){var a=arguments[0];return J(d)&&(a=f(d).apply(null,arguments),a===K)?c.onError(a.e):void c.onNext(a)})}).publish().refCount():N(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var N=y.fromEventPattern=function(a,b,c,d){return H(d)||(d=F),new B(function(d){function e(){var a=arguments[0];return J(c)&&(a=f(c).apply(null,arguments),a===K)?d.onError(a.e):void d.onNext(a)}var g=a(e);return D(function(){J(b)&&b(e,g)})}).publish().refCount()};return y.startAsync=function(a){var b;try{b=a()}catch(c){return A(c)}return z(b)},c});
//# sourceMappingURL=rx.async.compat.map

@@ -66,3 +66,12 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

var spawn = Observable.spawn = function () {
var wrap = Observable.wrap = function (fn) {
createObservable.__generatorFunction__ = fn;
return createObservable;
function createObservable() {
return Observable.spawn.call(this, fn.apply(this, arguments));
}
};
var spawn = Observable.spawn = function () {
var gen = arguments[0], self = this, args = [];

@@ -98,2 +107,3 @@ for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }

o.onCompleted();
return;
}

@@ -112,74 +122,73 @@ var value = toObservable.call(self, ret.value);

function toObservable(obj) {
if (!obj) { return obj; }
if (Observable.isObservable(obj)) { return obj; }
if (isPromise(obj)) { return Observable.fromPromise(obj); }
if (isGeneratorFunction(obj) || isGenerator(obj)) { return spawn.call(this, obj); }
if (isFunction(obj)) { return thunkToObservable.call(this, obj); }
if (isArrayLike(obj) || isIterable(obj)) { return arrayToObservable.call(this, obj); }
if (isObject(obj)) return objectToObservable.call(this, obj);
return obj;
}
function toObservable(obj) {
if (!obj) { return obj; }
if (Observable.isObservable(obj)) { return obj; }
if (isPromise(obj)) { return Observable.fromPromise(obj); }
if (isGeneratorFunction(obj) || isGenerator(obj)) { return spawn.call(this, obj); }
if (isFunction(obj)) { return thunkToObservable.call(this, obj); }
if (isArrayLike(obj) || isIterable(obj)) { return arrayToObservable.call(this, obj); }
if (isObject(obj)) {return objectToObservable.call(this, obj);}
return obj;
}
function arrayToObservable (obj) {
return Observable.from(obj)
.map(toObservable, this)
function arrayToObservable (obj) {
return Observable.from(obj)
.flatMap(toObservable)
.toArray();
}
}
function objectToObservable (obj) {
var results = new obj.constructor(), keys = Object.keys(obj), observables = [];
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i], observable = toObservable.call(this, obj[key]);
if (observable && Observable.isObservable(observable)) {
defer(observable, key);
} else {
results[key] = obj[key];
}
}
return Observable.concat(observables).startWith(results);
function objectToObservable (obj) {
var results = new obj.constructor(), keys = Object.keys(obj), observables = [];
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i];
var observable = toObservable.call(this, obj[key]);
function defer (observable, key) {
results[key] = undefined;
observables.push(new AnonymousObservable(function (o) {
return observable.subscribe(function (next) {
results[key] = next;
o.onCompleted();
});
}));
if(observable && Observable.isObservable(observable)) {
defer(observable, key);
} else {
results[key] = obj[key];
}
}
function thunkToObservable(fn) {
var self = this;
return new AnonymousObservable(function (o) {
fn.call(self, function () {
var err = arguments[0], res = arguments[1];
if (err) { return o.onError(err); }
if (arguments.length > 2) {
var args = [];
for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
res = args;
}
o.onNext(res);
o.onCompleted();
});
});
}
return Observable.forkJoin.apply(Observable, observables).map(function() {
return results;
});
function isGenerator(obj) {
return isFunction (obj.next) && isFunction (obj.throw);
}
function isGeneratorFunction(obj) {
var ctor = obj.constructor;
if (!ctor) { return false; }
if (ctor.name === 'GeneratorFunction' || ctor.displayName === 'GeneratorFunction') { return true; }
return isGenerator(ctor.prototype);
function defer (observable, key) {
results[key] = undefined;
observables.push(observable.map(function (next) {
results[key] = next;
}));
}
}
function isObject(val) {
return Object == val.constructor;
}
function thunkToObservable(fn) {
var self = this;
return new AnonymousObservable(function (o) {
fn.call(self, function () {
var err = arguments[0], res = arguments[1];
if (err) { return o.onError(err); }
if (arguments.length > 2) {
var args = [];
for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
res = args;
}
o.onNext(res);
o.onCompleted();
});
});
}
function isGenerator(obj) {
return isFunction (obj.next) && isFunction (obj.throw);
}
function isGeneratorFunction(obj) {
var ctor = obj.constructor;
if (!ctor) { return false; }
if (ctor.name === 'GeneratorFunction' || ctor.displayName === 'GeneratorFunction') { return true; }
return isGenerator(ctor.prototype);
}
/**

@@ -274,2 +283,4 @@ * Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.

return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len)

@@ -323,2 +334,3 @@ for(var i = 0; i < len; i++) { args[i] = arguments[i]; }

return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len);

@@ -348,4 +360,4 @@ for(var i = 0; i < len; i++) { args[i] = arguments[i]; }

// Asume NodeList or HTMLCollection
var toStr = Object.prototype.toString;
if (toStr.call(el) === '[object NodeList]' || toStr.call(el) === '[object HTMLCollection]') {
var elemToString = Object.prototype.toString.call(el);
if (elemToString === '[object NodeList]' || elemToString === '[object HTMLCollection]') {
for (var i = 0, len = el.length; i < len; i++) {

@@ -366,2 +378,13 @@ disposables.add(createEventListener(el.item(i), eventName, handler));

function eventHandler(o, selector) {
return function handler () {
var results = arguments[0];
if (isFunction(selector)) {
results = tryCatch(selector).apply(null, arguments);
if (results === errorObj) { return o.onError(results.e); }
}
o.onNext(results);
};
}
/**

@@ -394,13 +417,2 @@ * Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.

function eventHandler(o) {
return function handler () {
var results = arguments[0];
if (isFunction(selector)) {
results = tryCatch(selector).apply(null, arguments);
if (results === errorObj) { return o.onError(results.e); }
}
o.onNext(results);
};
}
return new AnonymousObservable(function (o) {

@@ -410,3 +422,3 @@ return createEventListener(

eventName,
eventHandler(o));
eventHandler(o, selector));
}).publish().refCount();

@@ -420,5 +432,7 @@ };

* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @param {Scheduler} [scheduler] A scheduler used to schedule the remove handler.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (o) {

@@ -425,0 +439,0 @@ function innerHandler () {

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"function":!0,object:!0},c=b[typeof exports]&&exports&&!exports.nodeType&&exports,d=b[typeof self]&&self.Object&&self,e=b[typeof window]&&window&&window.Object&&window,f=b[typeof module]&&module&&!module.nodeType&&module,g=(f&&f.exports===c&&c,c&&f&&"object"==typeof global&&global&&global.Object&&global),h=h=g||e!==(this&&this.window)&&e||d||this;"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,c){return h.Rx=a(h,c,b),h.Rx}):"object"==typeof module&&module&&module.exports===c?module.exports=a(h,module.exports,require("./rx")):h.Rx=a(h,{},h.Rx)}).call(this,function(a,b,c,d){function e(){try{return t.apply(this,arguments)}catch(a){return F.e=a,F}}function f(a){if(!E(a))throw new TypeError("fn must be a function");return t=a,e}function g(a){return a?u.isObservable(a)?a:D(a)?u.fromPromise(a):l(a)||k(a)?G.call(this,a):E(a)?j.call(this,a):isArrayLike(a)||isIterable(a)?h.call(this,a):m(a)?i.call(this,a):a:a}function h(a){return u.from(a).map(g,this).toArray()}function i(a){function b(a,b){c[b]=d,f.push(new x(function(d){return a.subscribe(function(a){c[b]=a,d.onCompleted()})}))}for(var c=new a.constructor,e=Object.keys(a),f=[],h=0,i=e.length;i>h;h++){var j=e[h],k=g.call(this,a[j]);k&&u.isObservable(k)?b(k,j):c[j]=a[j]}return u.concat(f).startWith(c)}function j(a){var b=this;return new x(function(c){a.call(b,function(){var a=arguments[0],b=arguments[1];if(a)return c.onError(a);if(arguments.length>2){for(var d=[],e=1,f=arguments.length;f>e;e++)d.push(arguments[e]);b=d}c.onNext(b),c.onCompleted()})})}function k(a){return E(a.next)&&E(a["throw"])}function l(a){var b=a.constructor;return b?"GeneratorFunction"===b.name||"GeneratorFunction"===b.displayName?!0:k(b.prototype):!1}function m(a){return Object==a.constructor}function n(a,b,c,d){var e=new y;return d.push(o(e,b,c)),a.apply(b,d),e.asObservable()}function o(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),g=0;d>g;g++)e[g]=arguments[g];if(E(c)){if(e=f(c).apply(b,e),e===F)return a.onError(e.e);a.onNext(e)}else e.length<=1?a.onNext(e[0]):a.onNext(e);a.onCompleted()}}function p(a,b,c,d){var e=new y;return d.push(q(e,b,c)),a.apply(b,d),e.asObservable()}function q(a,b,c){return function(){var d=arguments[0];if(d)return a.onError(d);for(var e=arguments.length,g=[],h=1;e>h;h++)g[h-1]=arguments[h];if(E(c)){var g=f(c).apply(b,g);if(g===F)return a.onError(g.e);a.onNext(g)}else g.length<=1?a.onNext(g[0]):a.onNext(g);a.onCompleted()}}function r(a,b,c){this._e=a,this._n=b,this._fn=c,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function s(a,b,c){var d=new A,e=Object.prototype.toString;if("[object NodeList]"===e.call(a)||"[object HTMLCollection]"===e.call(a))for(var f=0,g=a.length;g>f;f++)d.add(s(a.item(f),b,c));else a&&d.add(new r(a,b,c));return d}var t,u=c.Observable,v=(u.prototype,u.fromPromise),w=u.throwError,x=c.AnonymousObservable,y=c.AsyncSubject,z=c.Disposable.create,A=c.CompositeDisposable,B=(c.Scheduler.immediate,c.Scheduler["default"]),C=c.Scheduler.isScheduler,D=c.helpers.isPromise,E=c.helpers.isFunction,F={e:{}},G=u.spawn=function(){for(var a=arguments[0],b=this,c=[],d=1,e=arguments.length;e>d;d++)c.push(arguments[d]);return new x(function(d){function e(b){var c=f(a.next).call(a,b);return c===F?d.onError(c.e):void i(c)}function h(b){var c=f(a.next).call(a,b);return c===F?d.onError(c.e):void i(c)}function i(a){a.done&&(d.onNext(a.value),d.onCompleted());var c=g.call(b,a.value);u.isObservable(c)?j.add(c.subscribe(e,h)):h(new TypeError("type not supported"))}var j=new A;return E(a)&&(a=a.apply(b,c)),a&&E(a.next)?(e(),j):(d.onNext(a),d.onCompleted())})};u.start=function(a,b,c){return H(a,b,c)()};var H=u.toAsync=function(a,b,c){return C(c)||(c=B),function(){var d=arguments,e=new y;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};u.fromCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return n(a,b,c,e)}},u.fromNodeCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return p(a,b,c,e)}},r.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},c.config.useNativeEvents=!1,u.fromEvent=function(a,b,d){function e(a){return function(){var b=arguments[0];return E(d)&&(b=f(d).apply(null,arguments),b===F)?a.onError(b.e):void a.onNext(b)}}return a.addListener?I(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new x(function(c){return s(a,b,e(c))}).publish().refCount():I(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var I=u.fromEventPattern=function(a,b,c){return new x(function(d){function e(){var a=arguments[0];return E(c)&&(a=f(c).apply(null,arguments),a===F)?d.onError(a.e):void d.onNext(a)}var g=a(e);return z(function(){E(b)&&b(e,g)})}).publish().refCount()};return u.startAsync=function(a){var b;try{b=a()}catch(c){return w(c)}return v(b)},c});
(function(a){var b={"function":!0,object:!0},c=b[typeof exports]&&exports&&!exports.nodeType&&exports,d=b[typeof self]&&self.Object&&self,e=b[typeof window]&&window&&window.Object&&window,f=b[typeof module]&&module&&!module.nodeType&&module,g=(f&&f.exports===c&&c,c&&f&&"object"==typeof global&&global&&global.Object&&global),h=h=g||e!==(this&&this.window)&&e||d||this;"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,c){return h.Rx=a(h,c,b),h.Rx}):"object"==typeof module&&module&&module.exports===c?module.exports=a(h,module.exports,require("./rx")):h.Rx=a(h,{},h.Rx)}).call(this,function(a,b,c,d){function e(){try{return t.apply(this,arguments)}catch(a){return G.e=a,G}}function f(a){if(!F(a))throw new TypeError("fn must be a function");return t=a,e}function g(a){return a?u.isObservable(a)?a:E(a)?u.fromPromise(a):l(a)||k(a)?H.call(this,a):F(a)?j.call(this,a):isArrayLike(a)||isIterable(a)?h.call(this,a):isObject(a)?i.call(this,a):a:a}function h(a){return u.from(a).flatMap(g).toArray()}function i(a){function b(a,b){c[b]=d,f.push(a.map(function(a){c[b]=a}))}for(var c=new a.constructor,e=Object.keys(a),f=[],h=0,i=e.length;i>h;h++){var j=e[h],k=g.call(this,a[j]);k&&u.isObservable(k)?b(k,j):c[j]=a[j]}return u.forkJoin.apply(u,f).map(function(){return c})}function j(a){var b=this;return new x(function(c){a.call(b,function(){var a=arguments[0],b=arguments[1];if(a)return c.onError(a);if(arguments.length>2){for(var d=[],e=1,f=arguments.length;f>e;e++)d.push(arguments[e]);b=d}c.onNext(b),c.onCompleted()})})}function k(a){return F(a.next)&&F(a["throw"])}function l(a){var b=a.constructor;return b?"GeneratorFunction"===b.name||"GeneratorFunction"===b.displayName?!0:k(b.prototype):!1}function m(a,b,c,d){var e=new y;return d.push(n(e,b,c)),a.apply(b,d),e.asObservable()}function n(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),g=0;d>g;g++)e[g]=arguments[g];if(F(c)){if(e=f(c).apply(b,e),e===G)return a.onError(e.e);a.onNext(e)}else e.length<=1?a.onNext(e[0]):a.onNext(e);a.onCompleted()}}function o(a,b,c,d){var e=new y;return d.push(p(e,b,c)),a.apply(b,d),e.asObservable()}function p(a,b,c){return function(){var d=arguments[0];if(d)return a.onError(d);for(var e=arguments.length,g=[],h=1;e>h;h++)g[h-1]=arguments[h];if(F(c)){var g=f(c).apply(b,g);if(g===G)return a.onError(g.e);a.onNext(g)}else g.length<=1?a.onNext(g[0]):a.onNext(g);a.onCompleted()}}function q(a,b,c){this._e=a,this._n=b,this._fn=c,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function r(a,b,c){var d=new A,e=Object.prototype.toString.call(a);if("[object NodeList]"===e||"[object HTMLCollection]"===e)for(var f=0,g=a.length;g>f;f++)d.add(r(a.item(f),b,c));else a&&d.add(new q(a,b,c));return d}function s(a,b){return function(){var c=arguments[0];return F(b)&&(c=f(b).apply(null,arguments),c===G)?a.onError(c.e):void a.onNext(c)}}var t,u=c.Observable,v=(u.prototype,u.fromPromise),w=u.throwError,x=c.AnonymousObservable,y=c.AsyncSubject,z=c.Disposable.create,A=c.CompositeDisposable,B=c.Scheduler.immediate,C=c.Scheduler["default"],D=c.Scheduler.isScheduler,E=c.helpers.isPromise,F=c.helpers.isFunction,G={e:{}},H=(u.wrap=function(a){function b(){return u.spawn.call(this,a.apply(this,arguments))}return b.__generatorFunction__=a,b},u.spawn=function(){for(var a=arguments[0],b=this,c=[],d=1,e=arguments.length;e>d;d++)c.push(arguments[d]);return new x(function(d){function e(b){var c=f(a.next).call(a,b);return c===G?d.onError(c.e):void i(c)}function h(b){var c=f(a.next).call(a,b);return c===G?d.onError(c.e):void i(c)}function i(a){if(a.done)return d.onNext(a.value),void d.onCompleted();var c=g.call(b,a.value);u.isObservable(c)?j.add(c.subscribe(e,h)):h(new TypeError("type not supported"))}var j=new A;return F(a)&&(a=a.apply(b,c)),a&&F(a.next)?(e(),j):(d.onNext(a),d.onCompleted())})});u.start=function(a,b,c){return I(a,b,c)()};var I=u.toAsync=function(a,b,c){return D(c)||(c=C),function(){var d=arguments,e=new y;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};u.fromCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return m(a,b,c,e)}},u.fromNodeCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return o(a,b,c,e)}},q.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},c.config.useNativeEvents=!1,u.fromEvent=function(a,b,d){return a.addListener?J(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new x(function(c){return r(a,b,s(c,d))}).publish().refCount():J(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var J=u.fromEventPattern=function(a,b,c,d){return D(d)||(d=B),new x(function(d){function e(){var a=arguments[0];return F(c)&&(a=f(c).apply(null,arguments),a===G)?d.onError(a.e):void d.onNext(a)}var g=a(e);return z(function(){F(b)&&b(e,g)})}).publish().refCount()};return u.startAsync=function(a){var b;try{b=a()}catch(c){return w(c)}return v(b)},c});
//# sourceMappingURL=rx.async.map

@@ -182,3 +182,3 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
var inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }

@@ -185,0 +185,0 @@ __.prototype = parent.prototype;

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){function b(){try{return z.apply(this,arguments)}catch(a){return C.e=a,C}}function c(a){if(!isFunction(a))throw new TypeError("fn must be a function");return z=a,b}function d(a){throw a}function e(a,b){if(D&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(H)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var e=c.join("\n"+H+"\n");a.stack=f(e)}}function f(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var f=b[d];g(f)||h(f)||!f||c.push(f)}return c.join("\n")}function g(a){var b=j(a);if(!b)return!1;var c=b[0],d=b[1];return c===F&&d>=G&&ga>=d}function h(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function i(){if(D)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=j(c);if(!d)return;return F=d[0],d[1]}}function j(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}var k={"function":!0,object:!0},l=k[typeof exports]&&exports&&!exports.nodeType&&exports,m=k[typeof self]&&self.Object&&self,n=k[typeof window]&&window&&window.Object&&window,o=k[typeof module]&&module&&!module.nodeType&&module,p=o&&o.exports===l&&l,q=l&&o&&"object"==typeof global&&global&&global.Object&&global,r=r=q||n!==(this&&this.window)&&n||m||this,s={internals:{},config:{Promise:r.Promise},helpers:{}},t=s.helpers.noop=function(){},u=s.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}(),v=s.helpers.defaultError=function(a){throw a},w=(s.helpers.isPromise=function(a){return!!a&&!isFunction(a.subscribe)&&isFunction(a.then)},s.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0});isFunction=s.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==toString.call(a)}),a}();var x=s.NotImplementedError=function(a){this.message=a||"This operation is not implemented",Error.call(this)};x.prototype=Error.prototype;var y=s.NotSupportedError=function(a){this.message=a||"This operation is not supported",Error.call(this)};y.prototype=Error.prototype;var z,A=s.helpers.notImplemented=function(){throw new x},B=s.helpers.notSupported=function(){throw new y},C={e:{}};s.config.longStackSupport=!1;var D=!1,E=c(function(){throw new Error})();D=!!E.e&&!!E.e.stack;var F,G=i(),H="From previous event:",I=({}.hasOwnProperty,Array.prototype.slice,this.inherits=s.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),J=(s.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},s.internals.addRef=function(a,b){return new ea(function(c){return new J(b.getDisposable(),a.subscribe(c))})},s.CompositeDisposable=function(){var a,b,c=[];if(Array.isArray(arguments[0]))c=arguments[0],b=c.length;else for(b=arguments.length,c=new Array(b),a=0;b>a;a++)c[a]=arguments[a];for(a=0;b>a;a++)if(!O(c[a]))throw new TypeError("Not a disposable");this.disposables=c,this.isDisposed=!1,this.length=c.length}),K=J.prototype;K.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},K.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},K.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=this.disposables.length,b=new Array(a),c=0;a>c;c++)b[c]=this.disposables[c];for(this.disposables=[],this.length=0,c=0;a>c;c++)b[c].dispose()}};var L=s.Disposable=function(a){this.isDisposed=!1,this.action=a||t};L.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var M=L.create=function(a){return new L(a)},N=L.empty={dispose:t},O=L.isDisposable=function(a){return a&&isFunction(a.dispose)},P=(L.checkDisposed=function(a){if(a.isDisposed)throw new ObjectDisposedError},s.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null});P.prototype.getDisposable=function(){return this.current},P.prototype.setDisposable=function(a){if(this.current)throw new Error("Disposable has already been assigned");var b=this.isDisposed;!b&&(this.current=a),b&&a&&a.dispose()},P.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var Q=s.SerialDisposable=function(){this.isDisposed=!1,this.current=null};Q.prototype.getDisposable=function(){return this.current},Q.prototype.setDisposable=function(a){var b=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},Q.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var R=s.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||w,this.disposable=new P};R.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},R.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},R.prototype.isCancelled=function(){return this.disposable.isDisposed},R.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var S=s.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),N}a.isScheduler=function(b){return b instanceof a};var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=u,a.normalize=function(a){return 0>a&&(a=0),a},a}(),T=S.normalize;S.isScheduler;!function(a){function b(a,b){function c(b){function d(a,b){return g?f.remove(i):h=!0,e(b,c),N}var g=!1,h=!1,i=a.scheduleWithState(b,d);h||(f.add(i),g=!0)}var d=b[0],e=b[1],f=new J;return e(d,c),f}function c(a,b,c){function d(b,e){function h(a,b){return i?g.remove(k):j=!0,f(b,d),N}var i=!1,j=!1,k=a[c](b,e,h);j||(g.add(k),i=!0)}var e=b[0],f=b[1],g=new J;return f(e,d),g}function d(a,b){return c(a,b,"scheduleWithRelativeAndState")}function e(a,b){return c(a,b,"scheduleWithAbsoluteAndState")}function f(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,f)},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState([a,c],b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,f)},a.scheduleRecursiveWithRelativeAndState=function(a,b,c){return this._scheduleRelative([a,c],b,d)},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,f)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute([a,c],b,e)}}(S.prototype),function(a){S.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},S.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof r.setInterval)throw new y;b=T(b);var d=a,e=r.setInterval(function(){d=c(d)},b);return M(function(){r.clearInterval(e)})}}(S.prototype);var U,V,W=(s.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new P;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),S.immediate=function(){function a(a,b){return b(this,a)}return new S(u,a,B,B)}(),S.currentThread=function(){function a(){for(;e.length>0;){var a=e.shift();!a.isCancelled()&&a.invoke()}}function b(b,f){var g=new R(this,b,f,this.now());if(e)e.push(g);else{e=[g];var h=c(a)();if(e=null,h===C)return d(h.e)}return g.disposable}var e,f=new S(u,b,B,B);return f.scheduleRequired=function(){return!e},f}()),X=function(){var a,b=t;if(r.setTimeout)a=r.setTimeout,b=r.clearTimeout;else{if(!r.WScript)throw new y;a=function(a,b){r.WScript.Sleep(b),a()}}return{setTimeout:a,clearTimeout:b}}(),Y=X.setTimeout,Z=X.clearTimeout;!function(){function a(b){if(h)Y(function(){a(b)},0);else{var e=g[b];if(e){h=!0;var f=c(e)();if(V(b),h=!1,f===C)return d(f.e)}}}function b(){if(!r.postMessage||r.importScripts)return!1;var a=!1,b=r.onmessage;return r.onmessage=function(){a=!0},r.postMessage("","*"),r.onmessage=b,a}function e(b){"string"==typeof b.data&&b.data.substring(0,k.length)===k&&a(b.data.substring(k.length))}var f=1,g={},h=!1;V=function(a){delete g[a]};var i=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),j="function"==typeof(j=q&&p&&q.setImmediate)&&!i.test(j)&&j;if(isFunction(j))U=function(b){var c=f++;return g[c]=b,j(function(){a(c)}),c};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))U=function(b){var c=f++;return g[c]=b,process.nextTick(function(){a(c)}),c};else if(b()){var k="ms.rx.schedule"+Math.random();r.addEventListener?r.addEventListener("message",e,!1):r.attachEvent?r.attachEvent("onmessage",e):r.onmessage=e,U=function(a){var b=f++;return g[b]=a,r.postMessage(k+currentId,"*"),b}}else if(r.MessageChannel){var l=new r.MessageChannel;l.port1.onmessage=function(b){a(b.data)},U=function(a){var b=f++;return g[b]=a,l.port2.postMessage(b),b}}else U="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(b){var c=r.document.createElement("script"),d=f++;return g[d]=b,c.onreadystatechange=function(){a(d),c.onreadystatechange=null,c.parentNode.removeChild(c),c=null},r.document.documentElement.appendChild(c),d}:function(b){var c=f++;return g[c]=b,Y(function(){a(c)},0),c}}();var $,_=(S.timeout=S["default"]=function(){function a(a,b){var c=this,d=new P,e=U(function(){!d.isDisposed&&d.setDisposable(b(c,a))});return new J(d,M(function(){V(e)}))}function b(a,b,c){var d=this,e=S.normalize(b),f=new P;if(0===e)return d.scheduleWithState(a,c);var g=Y(function(){!f.isDisposed&&f.setDisposable(c(d,a))},e);return new J(f,M(function(){Z(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new S(u,a,b,c)}(),s.Observer=function(){}),aa=_.create=function(a,b,c){return a||(a=t),b||(b=v),c||(c=t),new ca(a,b,c)},ba=s.internals.AbstractObserver=function(a){function b(){this.isStopped=!1}return I(b,a),b.prototype.next=A,b.prototype.error=A,b.prototype.completed=A,b.prototype.onNext=function(a){!this.isStopped&&this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(_),ca=s.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return I(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(ba),da=s.Observable=function(){function a(a,b){return function(c){var d=c.onError;return c.onError=function(b){e(b,a),d.call(c,b)},b.call(a,c)}}function b(b){if(s.config.longStackSupport&&D){var e=c(d)(new Error).e;this.stack=e.stack.substring(e.stack.indexOf("\n")+1),this._subscribe=a(this,b)}else this._subscribe=b}return $=b.prototype,b.isObservable=function(a){return a&&isFunction(a.subscribe)},$.subscribe=$.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:aa(a,b,c))},$.subscribeOnNext=function(a,b){return this._subscribe(aa("undefined"!=typeof b?function(c){a.call(b,c)}:a))},$.subscribeOnError=function(a,b){return this._subscribe(aa(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},$.subscribeOnCompleted=function(a,b){return this._subscribe(aa(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},b}(),ea=s.AnonymousObservable=function(a){function b(a){return a&&isFunction(a.dispose)?a:isFunction(a)?M(a):N}function e(a,e){var f=e[0],g=e[1],h=c(g.__subscribe).call(g,f);return h!==C||f.fail(C.e)?void f.setDisposable(b(h)):d(C.e)}function f(a){var b=new fa(a),c=[b,this];return W.scheduleRequired()?W.scheduleWithState(c,e):e(null,c),b}function g(b,c){this.source=c,this.__subscribe=b,a.call(this,f)}return I(g,a),g}(da),fa=(s.ObservableBase=function(a){function b(a){return a&&isFunction(a.dispose)?a:isFunction(a)?M(a):N}function e(a,e){var f=e[0],g=e[1],h=c(g.subscribeCore).call(g,f);return h!==C||f.fail(C.e)?void f.setDisposable(b(h)):d(C.e)}function f(a){var b=new fa(a),c=[b,this];return W.scheduleRequired()?W.scheduleWithState(c,e):e(null,c),b}function g(){a.call(this,f)}return I(g,a),g.prototype.subscribeCore=A,g}(da),function(a){function b(b){a.call(this),this.observer=b,this.m=new P}I(b,a);var e=b.prototype;return e.next=function(a){var b=c(this.observer.onNext).call(this.observer,a);b===C&&(this.dispose(),d(b.e))},e.error=function(a){var b=c(this.observer.onError).call(this.observer,a);this.dispose(),b===C&&d(b.e)},e.completed=function(){var a=c(this.observer.onCompleted).call(this.observer);this.dispose(),a===C&&d(a.e)},e.setDisposable=function(a){this.m.setDisposable(a)},e.getDisposable=function(){return this.m.getDisposable()},e.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(ba));da.create=function(a,b){return new ea(a,b)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?(r.Rx=s,define(function(){return s})):l&&o?p?(o.exports=s).Rx=s:l.Rx=s:r.Rx=s;var ga=i()}).call(this);
(function(a){function b(){try{return z.apply(this,arguments)}catch(a){return C.e=a,C}}function c(a){if(!isFunction(a))throw new TypeError("fn must be a function");return z=a,b}function d(a){throw a}function e(a,b){if(D&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(H)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var e=c.join("\n"+H+"\n");a.stack=f(e)}}function f(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var f=b[d];g(f)||h(f)||!f||c.push(f)}return c.join("\n")}function g(a){var b=j(a);if(!b)return!1;var c=b[0],d=b[1];return c===F&&d>=G&&ga>=d}function h(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function i(){if(D)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=j(c);if(!d)return;return F=d[0],d[1]}}function j(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}var k={"function":!0,object:!0},l=k[typeof exports]&&exports&&!exports.nodeType&&exports,m=k[typeof self]&&self.Object&&self,n=k[typeof window]&&window&&window.Object&&window,o=k[typeof module]&&module&&!module.nodeType&&module,p=o&&o.exports===l&&l,q=l&&o&&"object"==typeof global&&global&&global.Object&&global,r=r=q||n!==(this&&this.window)&&n||m||this,s={internals:{},config:{Promise:r.Promise},helpers:{}},t=s.helpers.noop=function(){},u=s.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}(),v=s.helpers.defaultError=function(a){throw a},w=(s.helpers.isPromise=function(a){return!!a&&!isFunction(a.subscribe)&&isFunction(a.then)},s.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0});isFunction=s.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==toString.call(a)}),a}();var x=s.NotImplementedError=function(a){this.message=a||"This operation is not implemented",Error.call(this)};x.prototype=Error.prototype;var y=s.NotSupportedError=function(a){this.message=a||"This operation is not supported",Error.call(this)};y.prototype=Error.prototype;var z,A=s.helpers.notImplemented=function(){throw new x},B=s.helpers.notSupported=function(){throw new y},C={e:{}};s.config.longStackSupport=!1;var D=!1,E=c(function(){throw new Error})();D=!!E.e&&!!E.e.stack;var F,G=i(),H="From previous event:",I=({}.hasOwnProperty,Array.prototype.slice,s.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),J=(s.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},s.internals.addRef=function(a,b){return new ea(function(c){return new J(b.getDisposable(),a.subscribe(c))})},s.CompositeDisposable=function(){var a,b,c=[];if(Array.isArray(arguments[0]))c=arguments[0],b=c.length;else for(b=arguments.length,c=new Array(b),a=0;b>a;a++)c[a]=arguments[a];for(a=0;b>a;a++)if(!O(c[a]))throw new TypeError("Not a disposable");this.disposables=c,this.isDisposed=!1,this.length=c.length}),K=J.prototype;K.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},K.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},K.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=this.disposables.length,b=new Array(a),c=0;a>c;c++)b[c]=this.disposables[c];for(this.disposables=[],this.length=0,c=0;a>c;c++)b[c].dispose()}};var L=s.Disposable=function(a){this.isDisposed=!1,this.action=a||t};L.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var M=L.create=function(a){return new L(a)},N=L.empty={dispose:t},O=L.isDisposable=function(a){return a&&isFunction(a.dispose)},P=(L.checkDisposed=function(a){if(a.isDisposed)throw new ObjectDisposedError},s.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null});P.prototype.getDisposable=function(){return this.current},P.prototype.setDisposable=function(a){if(this.current)throw new Error("Disposable has already been assigned");var b=this.isDisposed;!b&&(this.current=a),b&&a&&a.dispose()},P.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var Q=s.SerialDisposable=function(){this.isDisposed=!1,this.current=null};Q.prototype.getDisposable=function(){return this.current},Q.prototype.setDisposable=function(a){var b=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},Q.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var R=s.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||w,this.disposable=new P};R.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},R.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},R.prototype.isCancelled=function(){return this.disposable.isDisposed},R.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var S=s.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),N}a.isScheduler=function(b){return b instanceof a};var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=u,a.normalize=function(a){return 0>a&&(a=0),a},a}(),T=S.normalize;S.isScheduler;!function(a){function b(a,b){function c(b){function d(a,b){return g?f.remove(i):h=!0,e(b,c),N}var g=!1,h=!1,i=a.scheduleWithState(b,d);h||(f.add(i),g=!0)}var d=b[0],e=b[1],f=new J;return e(d,c),f}function c(a,b,c){function d(b,e){function h(a,b){return i?g.remove(k):j=!0,f(b,d),N}var i=!1,j=!1,k=a[c](b,e,h);j||(g.add(k),i=!0)}var e=b[0],f=b[1],g=new J;return f(e,d),g}function d(a,b){return c(a,b,"scheduleWithRelativeAndState")}function e(a,b){return c(a,b,"scheduleWithAbsoluteAndState")}function f(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,f)},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState([a,c],b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,f)},a.scheduleRecursiveWithRelativeAndState=function(a,b,c){return this._scheduleRelative([a,c],b,d)},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,f)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute([a,c],b,e)}}(S.prototype),function(a){S.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},S.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof r.setInterval)throw new y;b=T(b);var d=a,e=r.setInterval(function(){d=c(d)},b);return M(function(){r.clearInterval(e)})}}(S.prototype);var U,V,W=(s.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new P;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),S.immediate=function(){function a(a,b){return b(this,a)}return new S(u,a,B,B)}(),S.currentThread=function(){function a(){for(;e.length>0;){var a=e.shift();!a.isCancelled()&&a.invoke()}}function b(b,f){var g=new R(this,b,f,this.now());if(e)e.push(g);else{e=[g];var h=c(a)();if(e=null,h===C)return d(h.e)}return g.disposable}var e,f=new S(u,b,B,B);return f.scheduleRequired=function(){return!e},f}()),X=function(){var a,b=t;if(r.setTimeout)a=r.setTimeout,b=r.clearTimeout;else{if(!r.WScript)throw new y;a=function(a,b){r.WScript.Sleep(b),a()}}return{setTimeout:a,clearTimeout:b}}(),Y=X.setTimeout,Z=X.clearTimeout;!function(){function a(b){if(h)Y(function(){a(b)},0);else{var e=g[b];if(e){h=!0;var f=c(e)();if(V(b),h=!1,f===C)return d(f.e)}}}function b(){if(!r.postMessage||r.importScripts)return!1;var a=!1,b=r.onmessage;return r.onmessage=function(){a=!0},r.postMessage("","*"),r.onmessage=b,a}function e(b){"string"==typeof b.data&&b.data.substring(0,k.length)===k&&a(b.data.substring(k.length))}var f=1,g={},h=!1;V=function(a){delete g[a]};var i=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),j="function"==typeof(j=q&&p&&q.setImmediate)&&!i.test(j)&&j;if(isFunction(j))U=function(b){var c=f++;return g[c]=b,j(function(){a(c)}),c};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))U=function(b){var c=f++;return g[c]=b,process.nextTick(function(){a(c)}),c};else if(b()){var k="ms.rx.schedule"+Math.random();r.addEventListener?r.addEventListener("message",e,!1):r.attachEvent?r.attachEvent("onmessage",e):r.onmessage=e,U=function(a){var b=f++;return g[b]=a,r.postMessage(k+currentId,"*"),b}}else if(r.MessageChannel){var l=new r.MessageChannel;l.port1.onmessage=function(b){a(b.data)},U=function(a){var b=f++;return g[b]=a,l.port2.postMessage(b),b}}else U="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(b){var c=r.document.createElement("script"),d=f++;return g[d]=b,c.onreadystatechange=function(){a(d),c.onreadystatechange=null,c.parentNode.removeChild(c),c=null},r.document.documentElement.appendChild(c),d}:function(b){var c=f++;return g[c]=b,Y(function(){a(c)},0),c}}();var $,_=(S.timeout=S["default"]=function(){function a(a,b){var c=this,d=new P,e=U(function(){!d.isDisposed&&d.setDisposable(b(c,a))});return new J(d,M(function(){V(e)}))}function b(a,b,c){var d=this,e=S.normalize(b),f=new P;if(0===e)return d.scheduleWithState(a,c);var g=Y(function(){!f.isDisposed&&f.setDisposable(c(d,a))},e);return new J(f,M(function(){Z(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new S(u,a,b,c)}(),s.Observer=function(){}),aa=_.create=function(a,b,c){return a||(a=t),b||(b=v),c||(c=t),new ca(a,b,c)},ba=s.internals.AbstractObserver=function(a){function b(){this.isStopped=!1}return I(b,a),b.prototype.next=A,b.prototype.error=A,b.prototype.completed=A,b.prototype.onNext=function(a){!this.isStopped&&this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(_),ca=s.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return I(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(ba),da=s.Observable=function(){function a(a,b){return function(c){var d=c.onError;return c.onError=function(b){e(b,a),d.call(c,b)},b.call(a,c)}}function b(b){if(s.config.longStackSupport&&D){var e=c(d)(new Error).e;this.stack=e.stack.substring(e.stack.indexOf("\n")+1),this._subscribe=a(this,b)}else this._subscribe=b}return $=b.prototype,b.isObservable=function(a){return a&&isFunction(a.subscribe)},$.subscribe=$.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:aa(a,b,c))},$.subscribeOnNext=function(a,b){return this._subscribe(aa("undefined"!=typeof b?function(c){a.call(b,c)}:a))},$.subscribeOnError=function(a,b){return this._subscribe(aa(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},$.subscribeOnCompleted=function(a,b){return this._subscribe(aa(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},b}(),ea=s.AnonymousObservable=function(a){function b(a){return a&&isFunction(a.dispose)?a:isFunction(a)?M(a):N}function e(a,e){var f=e[0],g=e[1],h=c(g.__subscribe).call(g,f);return h!==C||f.fail(C.e)?void f.setDisposable(b(h)):d(C.e)}function f(a){var b=new fa(a),c=[b,this];return W.scheduleRequired()?W.scheduleWithState(c,e):e(null,c),b}function g(b,c){this.source=c,this.__subscribe=b,a.call(this,f)}return I(g,a),g}(da),fa=(s.ObservableBase=function(a){function b(a){return a&&isFunction(a.dispose)?a:isFunction(a)?M(a):N}function e(a,e){var f=e[0],g=e[1],h=c(g.subscribeCore).call(g,f);return h!==C||f.fail(C.e)?void f.setDisposable(b(h)):d(C.e)}function f(a){var b=new fa(a),c=[b,this];return W.scheduleRequired()?W.scheduleWithState(c,e):e(null,c),b}function g(){a.call(this,f)}return I(g,a),g.prototype.subscribeCore=A,g}(da),function(a){function b(b){a.call(this),this.observer=b,this.m=new P}I(b,a);var e=b.prototype;return e.next=function(a){var b=c(this.observer.onNext).call(this.observer,a);b===C&&(this.dispose(),d(b.e))},e.error=function(a){var b=c(this.observer.onError).call(this.observer,a);this.dispose(),b===C&&d(b.e)},e.completed=function(){var a=c(this.observer.onCompleted).call(this.observer);this.dispose(),a===C&&d(a.e)},e.setDisposable=function(a){this.m.setDisposable(a)},e.getDisposable=function(){return this.m.getDisposable()},e.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(ba));da.create=function(a,b){return new ea(a,b)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?(r.Rx=s,define(function(){return s})):l&&o?p?(o.exports=s).Rx=s:l.Rx=s:r.Rx=s;var ga=i()}).call(this);
//# sourceMappingURL=rx.core.map

@@ -5,3 +5,3 @@ {

"description": "Library for composing asynchronous and event-based operations in JavaScript",
"version": "3.0.0",
"version": "3.0.1",
"homepage": "https://github.com/Reactive-Extensions/RxJS",

@@ -8,0 +8,0 @@ "author": {

@@ -205,6 +205,7 @@ [![Build Status](https://travis-ci.org/Reactive-Extensions/RxJS.png)](https://travis-ci.org/Reactive-Extensions/RxJS)

- [Our Code of Conduct](https://github.com/Reactive-Extensions/RxJS/tree/code-of-conduct.md)
- [The full documentation](https://github.com/Reactive-Extensions/RxJS/tree/master/doc)
- [Our many great examples](https://github.com/Reactive-Extensions/RxJS/tree/master/examples)
- [Our design guidelines](https://github.com/Reactive-Extensions/RxJS/tree/master/doc/designguidelines)
- [Our contribution guidelines](https://github.com/Reactive-Extensions/RxJS/tree/master/doc/contributing)
- [Our contribution guidelines](https://github.com/Reactive-Extensions/RxJS/tree/contributing.md)
- [Our complete Unit Tests](https://github.com/Reactive-Extensions/RxJS/tree/master/tests)

@@ -211,0 +212,0 @@ - [Our recipes](https://github.com/Reactive-Extensions/RxJS/wiki/Recipes)

var EmptyError = Rx.EmptyError = function() {
this.message = 'Sequence contains no elements.';
this.name = 'EmptyError';
Error.call(this);

@@ -9,2 +10,3 @@ };

this.message = 'Object has been disposed';
this.name = 'ObjectDisposedError';
Error.call(this);

@@ -16,2 +18,3 @@ };

this.message = 'Argument out of range';
this.name = 'ArgumentOutOfRangeError';
Error.call(this);

@@ -23,2 +26,3 @@ };

this.message = message || 'This operation is not supported';
this.name = 'NotSupportedError';
Error.call(this);

@@ -30,2 +34,3 @@ };

this.message = message || 'This operation is not implemented';
this.name = 'NotImplementedError';
Error.call(this);

@@ -32,0 +37,0 @@ };

var hasProp = {}.hasOwnProperty,
slice = Array.prototype.slice;
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
var inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }

@@ -6,0 +6,0 @@ __.prototype = parent.prototype;

@@ -6,3 +6,3 @@ /**

*/
observableProto['finally'] = observableProto.ensure = function (action) {
observableProto['finally'] = function (action) {
var source = this;

@@ -9,0 +9,0 @@ return new AnonymousObservable(function (observer) {

@@ -5,8 +5,10 @@ /**

* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Mixed} [ctx] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
Observable.fromCallback = function (func, context, selector) {
Observable.fromCallback = function (func, ctx, selector) {
return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len)

@@ -22,3 +24,3 @@ for(var i = 0; i < len; i++) { args[i] = arguments[i]; }

if (isFunction(selector)) {
results = tryCatch(selector).apply(context, results);
results = tryCatch(selector).apply(ctx, results);
if (results === errorObj) { return subject.onError(results.e); }

@@ -38,3 +40,3 @@ subject.onNext(results);

args.push(handler);
func.apply(context, args);
func.apply(ctx, args);

@@ -41,0 +43,0 @@ return subject.asObservable();

@@ -19,4 +19,4 @@ function ListenDisposable(e, n, fn) {

// Asume NodeList or HTMLCollection
var toStr = Object.prototype.toString;
if (toStr.call(el) === '[object NodeList]' || toStr.call(el) === '[object HTMLCollection]') {
var elemToString = Object.prototype.toString.call(el);
if (elemToString === '[object NodeList]' || elemToString === '[object HTMLCollection]') {
for (var i = 0, len = el.length; i < len; i++) {

@@ -37,2 +37,13 @@ disposables.add(createEventListener(el.item(i), eventName, handler));

function eventHandler(o, selector) {
return function handler () {
var results = arguments[0];
if (isFunction(selector)) {
results = tryCatch(selector).apply(null, arguments);
if (results === errorObj) { return o.onError(results.e); }
}
o.onNext(results);
};
}
/**

@@ -65,13 +76,2 @@ * Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.

function eventHandler(o) {
return function handler () {
var results = arguments[0];
if (isFunction(selector)) {
results = tryCatch(selector).apply(null, arguments);
if (results === errorObj) { return o.onError(results.e); }
}
o.onNext(results);
};
}
return new AnonymousObservable(function (o) {

@@ -81,4 +81,4 @@ return createEventListener(

eventName,
eventHandler(o));
eventHandler(o, selector));
}).publish().refCount();
};

@@ -6,5 +6,7 @@ /**

* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @param {Scheduler} [scheduler] A scheduler used to schedule the remove handler.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (o) {

@@ -11,0 +13,0 @@ function innerHandler () {

/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Mixed} [ctx] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
Observable.fromNodeCallback = function (func, context, selector) {
Observable.fromNodeCallback = function (func, ctx, selector) {
return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len);

@@ -23,3 +25,3 @@ for(var i = 0; i < len; i++) { args[i] = arguments[i]; }

if (isFunction(selector)) {
var results = tryCatch(selector).apply(context, results);
var results = tryCatch(selector).apply(ctx, results);
if (results === errorObj) { return o.onError(results.e); }

@@ -39,3 +41,3 @@ o.onNext(results);

args.push(handler);
func.apply(context, args);
func.apply(ctx, args);

@@ -42,0 +44,0 @@ return o.asObservable();

@@ -1,2 +0,11 @@

var spawn = Observable.spawn = function () {
var wrap = Observable.wrap = function (fn) {
createObservable.__generatorFunction__ = fn;
return createObservable;
function createObservable() {
return Observable.spawn.call(this, fn.apply(this, arguments));
}
};
var spawn = Observable.spawn = function () {
var gen = arguments[0], self = this, args = [];

@@ -32,2 +41,3 @@ for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }

o.onCompleted();
return;
}

@@ -46,72 +56,71 @@ var value = toObservable.call(self, ret.value);

function toObservable(obj) {
if (!obj) { return obj; }
if (Observable.isObservable(obj)) { return obj; }
if (isPromise(obj)) { return Observable.fromPromise(obj); }
if (isGeneratorFunction(obj) || isGenerator(obj)) { return spawn.call(this, obj); }
if (isFunction(obj)) { return thunkToObservable.call(this, obj); }
if (isArrayLike(obj) || isIterable(obj)) { return arrayToObservable.call(this, obj); }
if (isObject(obj)) return objectToObservable.call(this, obj);
return obj;
}
function toObservable(obj) {
if (!obj) { return obj; }
if (Observable.isObservable(obj)) { return obj; }
if (isPromise(obj)) { return Observable.fromPromise(obj); }
if (isGeneratorFunction(obj) || isGenerator(obj)) { return spawn.call(this, obj); }
if (isFunction(obj)) { return thunkToObservable.call(this, obj); }
if (isArrayLike(obj) || isIterable(obj)) { return arrayToObservable.call(this, obj); }
if (isObject(obj)) {return objectToObservable.call(this, obj);}
return obj;
}
function arrayToObservable (obj) {
return Observable.from(obj)
.map(toObservable, this)
function arrayToObservable (obj) {
return Observable.from(obj)
.flatMap(toObservable)
.toArray();
}
}
function objectToObservable (obj) {
var results = new obj.constructor(), keys = Object.keys(obj), observables = [];
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i], observable = toObservable.call(this, obj[key]);
if (observable && Observable.isObservable(observable)) {
defer(observable, key);
} else {
results[key] = obj[key];
}
}
return Observable.concat(observables).startWith(results);
function objectToObservable (obj) {
var results = new obj.constructor(), keys = Object.keys(obj), observables = [];
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i];
var observable = toObservable.call(this, obj[key]);
function defer (observable, key) {
results[key] = undefined;
observables.push(new AnonymousObservable(function (o) {
return observable.subscribe(function (next) {
results[key] = next;
o.onCompleted();
});
}));
if(observable && Observable.isObservable(observable)) {
defer(observable, key);
} else {
results[key] = obj[key];
}
}
function thunkToObservable(fn) {
var self = this;
return new AnonymousObservable(function (o) {
fn.call(self, function () {
var err = arguments[0], res = arguments[1];
if (err) { return o.onError(err); }
if (arguments.length > 2) {
var args = [];
for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
res = args;
}
o.onNext(res);
o.onCompleted();
});
});
}
return Observable.forkJoin.apply(Observable, observables).map(function() {
return results;
});
function isGenerator(obj) {
return isFunction (obj.next) && isFunction (obj.throw);
}
function isGeneratorFunction(obj) {
var ctor = obj.constructor;
if (!ctor) { return false; }
if (ctor.name === 'GeneratorFunction' || ctor.displayName === 'GeneratorFunction') { return true; }
return isGenerator(ctor.prototype);
function defer (observable, key) {
results[key] = undefined;
observables.push(observable.map(function (next) {
results[key] = next;
}));
}
}
function isObject(val) {
return Object == val.constructor;
}
function thunkToObservable(fn) {
var self = this;
return new AnonymousObservable(function (o) {
fn.call(self, function () {
var err = arguments[0], res = arguments[1];
if (err) { return o.onError(err); }
if (arguments.length > 2) {
var args = [];
for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
res = args;
}
o.onNext(res);
o.onCompleted();
});
});
}
function isGenerator(obj) {
return isFunction (obj.next) && isFunction (obj.throw);
}
function isGeneratorFunction(obj) {
var ctor = obj.constructor;
if (!ctor) { return false; }
if (ctor.name === 'GeneratorFunction' || ctor.displayName === 'GeneratorFunction') { return true; }
return isGenerator(ctor.prototype);
}

@@ -9,9 +9,9 @@ var EmptyObservable = (function(__super__) {

EmptyObservable.prototype.subscribeCore = function (observer) {
var sink = new EmptySink(observer, this);
var sink = new EmptySink(observer, this.scheduler);
return sink.run();
};
function EmptySink(observer, parent) {
function EmptySink(observer, scheduler) {
this.observer = observer;
this.parent = parent;
this.scheduler = scheduler;
}

@@ -21,6 +21,7 @@

state.onCompleted();
return disposableEmpty;
}
EmptySink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState(this.observer, scheduleItem);
return this.scheduler.scheduleWithState(this.observer, scheduleItem);
};

@@ -31,2 +32,4 @@

var EMPTY_OBSERVABLE = new EmptyObservable(immediateScheduler);
/**

@@ -43,3 +46,3 @@ * Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.

isScheduler(scheduler) || (scheduler = immediateScheduler);
return new EmptyObservable(scheduler);
return scheduler === immediateScheduler ? EMPTY_OBSERVABLE : new EmptyObservable(scheduler);
};

@@ -5,3 +5,3 @@ var FinallyObservable = (function (__super__) {

this.source = source;
this.action = bindCallback(action, thisArg, 1);
this.action = bindCallback(action, thisArg, 0);
__super__.call(this);

@@ -37,4 +37,4 @@ }

*/
observableProto['finally'] = observableProto.ensure = observableProto.finallyAction = function (action, thisArg) {
observableProto['finally'] = function (action, thisArg) {
return new FinallyObservable(this, action, thisArg);
};

@@ -41,2 +41,4 @@ function createCbObservable(fn, ctx, selector, args) {

return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len)

@@ -43,0 +45,0 @@ for(var i = 0; i < len; i++) { args[i] = arguments[i]; }

@@ -43,2 +43,3 @@ function createNodeObservable(fn, ctx, selector, args) {

return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len);

@@ -45,0 +46,0 @@ for(var i = 0; i < len; i++) { args[i] = arguments[i]; }

@@ -10,9 +10,10 @@ var JustObservable = (function(__super__) {

JustObservable.prototype.subscribeCore = function (observer) {
var sink = new JustSink(observer, this);
var sink = new JustSink(observer, this.value, this.scheduler);
return sink.run();
};
function JustSink(observer, parent) {
function JustSink(observer, value, scheduler) {
this.observer = observer;
this.parent = parent;
this.value = value;
this.scheduler = scheduler;
}

@@ -24,6 +25,10 @@

observer.onCompleted();
return disposableEmpty;
}
JustSink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState([this.parent.value, this.observer], scheduleItem);
var state = [this.value, this.observer];
return this.scheduler === immediateScheduler ?
scheduleItem(null, state) :
this.scheduler.scheduleWithState(state, scheduleItem);
};

@@ -30,0 +35,0 @@

@@ -14,2 +14,4 @@ var NeverObservable = (function(__super__) {

var NEVER_OBSERVABLE = new NeverObservable();
/**

@@ -20,3 +22,3 @@ * Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).

var observableNever = Observable.never = function () {
return new NeverObservable();
return NEVER_OBSERVABLE;
};

@@ -1,53 +0,410 @@

// Type definitions for RxJS-Aggregates v2.2.28
// Project: http://rx.codeplex.com/
// Definitions by: Carl de Billy <http://carl.debilly.net/>, Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
///<reference path="rx.d.ts" />
// Type alias for observables and promises
export type ObservableOrPromise<T> = IObservable<T> | Promise<T>;
declare module Rx {
export interface Observable<T> {
finalValue(): Observable<T>;
aggregate(accumulator: (acc: T, value: T) => T): Observable<T>;
aggregate<TAcc>(seed: TAcc, accumulator: (acc: TAcc, value: T) => TAcc): Observable<TAcc>;
export type ArrayLike<T> = Array<T> | { length: number;[index: number]: T; };
reduce(accumulator: (acc: T, value: T) => T): Observable<T>;
reduce<TAcc>(accumulator: (acc: TAcc, value: T) => TAcc, seed: TAcc): Observable<TAcc>; // TS0.9.5: won't work https://typescript.codeplex.com/discussions/471751
// Type alias for arrays and array like objects
export type ArrayOrIterable<T> = ArrayLike<T>;
any(predicate?: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<boolean>;
some(predicate?: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<boolean>; // alias for any
/**
* Promise A+
*/
export interface Promise<T> {
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected: (error: any) => Promise<R>): Promise<R>;
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected?: (error: any) => R): Promise<R>;
}
isEmpty(): Observable<boolean>;
all(predicate?: (value: T) => boolean, thisArg?: any): Observable<boolean>;
every(predicate?: (value: T) => boolean, thisArg?: any): Observable<boolean>; // alias for all
contains(value: T): Observable<boolean>;
contains<TOther>(value: TOther, comparer: (value1: T, value2: TOther) => boolean): Observable<boolean>;
count(predicate?: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<number>;
sum(keySelector?: (value: T, index: number, source: Observable<T>) => number, thisArg?: any): Observable<number>;
minBy<TKey>(keySelector: (item: T) => TKey, comparer: (value1: TKey, value2: TKey) => number): Observable<T>;
minBy(keySelector: (item: T) => number): Observable<T>;
min(comparer?: (value1: T, value2: T) => number): Observable<T>;
maxBy<TKey>(keySelector: (item: T) => TKey, comparer: (value1: TKey, value2: TKey) => number): Observable<T>;
maxBy(keySelector: (item: T) => number): Observable<T>;
max(comparer?: (value1: T, value2: T) => number): Observable<number>;
average(keySelector?: (value: T, index: number, source: Observable<T>) => number, thisArg?: any): Observable<number>;
/**
* Promise A+
*/
export type IPromise<T> = Promise<T>;
sequenceEqual<TOther>(second: Observable<TOther>, comparer: (value1: T, value2: TOther) => number): Observable<boolean>;
sequenceEqual<TOther>(second: IPromise<TOther>, comparer: (value1: T, value2: TOther) => number): Observable<boolean>;
sequenceEqual(second: Observable<T>): Observable<boolean>;
sequenceEqual(second: IPromise<T>): Observable<boolean>;
sequenceEqual<TOther>(second: TOther[], comparer: (value1: T, value2: TOther) => number): Observable<boolean>;
sequenceEqual(second: T[]): Observable<boolean>;
/**
* Represents a push-style collection.
*/
export interface IObservable<T> { }
elementAt(index: number): Observable<T>;
single(predicate?: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<T>;
first(predicate?: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<T>;
last(predicate?: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<T>;
find(predicate: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<T>;
findIndex(predicate: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<number>;
}
/**
* Represents a push-style collection.
*/
export interface Observable<T> { }
export interface Observable<T> {
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @param {Any} [seed] The initial accumulator value.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
reduce<TAcc>(accumulator: _Accumulator<T, TAcc>, seed?: TAcc): Observable<TAcc>;
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @param {Any} [seed] The initial accumulator value.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
reduce(accumulator: _Accumulator<T, T>, seed?: T): Observable<T>;
}
export interface Observable<T> {
/**
* Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence.
* @param {Function} [predicate] A function to test each element for a condition.
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
*/
some(predicate?: _Predicate<T>, thisArg?: any): Observable<boolean>; // alias for any
}
export module config {
export var Promise: { new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise<T>; };
}
export module helpers {
export var noop: () => void;
export var notDefined: (value: any) => boolean;
export var identity: <T>(value: T) => T;
export var defaultNow: () => number;
export var defaultComparer: (left: any, right: any) => boolean;
export var defaultSubComparer: (left: any, right: any) => number;
export var defaultKeySerializer: (key: any) => string;
export var defaultError: (err: any) => void;
export var isPromise: (p: any) => boolean;
export var asArray: <T>(...args: T[]) => T[];
export var not: (value: any) => boolean;
export var isFunction: (value: any) => boolean;
}
export type _Selector<T, TResult> = (value: T, index: number, observable: Observable<T>) => TResult;
export type _ValueOrSelector<T, TResult> = TResult | _Selector<T, TResult>;
export type _Predicate<T> = _Selector<T, boolean>;
export type _Comparer<T, TResult> = (value1: T, value2: T) => TResult;
export type _Accumulator<T, TAcc> = (acc: TAcc, value: T) => TAcc;
export module special {
export type _FlatMapResultSelector<T1, T2, TResult> = (value: T1, selectorValue: T2, index: number, selectorOther: number) => TResult;
}
export interface IObservable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface Observable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable;
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface ObservableStatic {
/**
* Determines whether the given object is an Observable
* @param {Any} An object to determine whether it is an Observable
* @returns {Boolean} true if an Observable, else false.
*/
isObservable(o: any): boolean;
}
export var Observable: ObservableStatic;
export interface Observable<T> {
/**
* Determines whether an observable sequence is empty.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
*/
isEmpty(): Observable<boolean>;
}
export interface Observable<T> {
/**
* Determines whether all elements of an observable sequence satisfy a condition.
* @param {Function} [predicate] A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.
*/
every(predicate?: _Predicate<T>, thisArg?: any): Observable<boolean>; // alias for all
}
export interface Observable<T> {
/**
* Determines whether an observable sequence includes a specified element with an optional equality comparer.
* @param searchElement The value to locate in the source sequence.
* @param {Number} [fromIndex] An equality comparer to compare elements.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence includes an element that has the specified value from the given index.
*/
includes(value: T, comparer?: _Comparer<T, boolean>): Observable<boolean>;
}
export interface Observable<T> {
/**
* Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items.
* @example
* res = source.count();
* res = source.count(function (x) { return x > 3; });
* @param {Function} [predicate]A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence.
*/
count(predicate?: _Predicate<T>, thisArg?: any): Observable<number>;
}
export interface Observable<T> {
/**
* Returns the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
* @param {Any} searchElement Element to locate in the array.
* @param {Number} [fromIndex] The index to start the search. If not specified, defaults to 0.
* @returns {Observable} And observable sequence containing the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
*/
indexOf(element: T, fromIndex?: number): Observable<number>;
}
export interface Observable<T> {
/**
* Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence.
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.
*/
sum(keySelector?: _Selector<T, number>, thisArg?: any): Observable<number>;
}
export interface Observable<T> {
/**
* Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
* @example
* var res = source.minBy(function (x) { return x.value; });
* var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.
*/
minBy<TKey>(keySelector: (item: T) => TKey, comparer: _Comparer<TKey, number>): Observable<T>;
/**
* Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
* @example
* var res = source.minBy(function (x) { return x.value; });
* var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.
*/
minBy(keySelector: (item: T) => number): Observable<T>;
}
export interface Observable<T> {
/**
* Returns the minimum element in an observable sequence according to the optional comparer else a default greater than less than check.
* @example
* var res = source.min();
* var res = source.min(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence.
*/
min(comparer?: _Comparer<T, number>): Observable<number>;
}
export interface Observable<T> {
/**
* Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
* @example
* var res = source.maxBy(function (x) { return x.value; });
* var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.
*/
maxBy<TKey>(keySelector: (item: T) => TKey, comparer: _Comparer<TKey, number>): Observable<T>;
/**
* Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
* @example
* var res = source.maxBy(function (x) { return x.value; });
* var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.
*/
maxBy(keySelector: (item: T) => number): Observable<T>;
}
export interface Observable<T> {
/**
* Returns the maximum value in an observable sequence according to the specified comparer.
* @example
* var res = source.max();
* var res = source.max(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence.
*/
max(comparer?: _Comparer<T, number>): Observable<number>;
}
export interface Observable<T> {
/**
* Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present.
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values.
*/
average(keySelector?: _Selector<T, number>, thisArg?: any): Observable<number>;
}
export interface Observable<T> {
/**
* Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
*
* @example
* var res = res = source.sequenceEqual([1,2,3]);
* var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });
* 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42));
* 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });
* @param {Observable} second Second observable sequence or array to compare.
* @param {Function} [comparer] Comparer used to compare elements of both sequences.
* @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
*/
sequenceEqual(second: ObservableOrPromise<T> | ArrayOrIterable<T>, comparer?: _Comparer<T, boolean>): Observable<boolean>;
/**
* Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
*
* @example
* var res = res = source.sequenceEqual([1,2,3]);
* var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });
* 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42));
* 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });
* @param {Observable} second Second observable sequence or array to compare.
* @param {Function} [comparer] Comparer used to compare elements of both sequences.
* @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
*/
sequenceEqual<TOther>(second: ObservableOrPromise<T> | ArrayOrIterable<T>, comparer: _Comparer<T | TOther, boolean>): Observable<boolean>;
}
export interface Observable<T> {
/**
* Returns the element at a specified index in a sequence or default value if not found.
* @param {Number} index The zero-based index of the element to retrieve.
* @param {Any} [defaultValue] The default value to use if elementAt does not find a value.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence.
*/
elementAt(index: number): Observable<T>;
}
export interface Observable<T> {
/**
* Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
*/
single(predicate?: _Predicate<T>, thisArg?: any): Observable<T>;
}
export interface Observable<T> {
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate if present else the first item in the sequence.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence.
*/
first(predicate?: _Predicate<T>, thisArg?: any): Observable<T>;
}
export interface Observable<T> {
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate if specified, else the last element.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.
*/
last(predicate?: _Predicate<T>, thisArg?: any): Observable<T>;
}
export interface Observable<T> {
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined.
*/
find(predicate: _Predicate<T>, thisArg?: any): Observable<T>;
}
export interface Observable<T> {
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns
* an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1.
*/
findIndex(predicate: _Predicate<T>, thisArg?: any): Observable<number>;
}
}
declare module "rx.aggregates" {
export = Rx;
}
declare module "rx" { export = Rx; }
declare module "rx.aggregates" { export = Rx; }

@@ -1,43 +0,519 @@

// Type definitions for RxJS-Async v2.2.28
// Project: http://rx.codeplex.com/
// Definitions by: zoetrope <https://github.com/zoetrope>, Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
///<reference path="rx.d.ts" />
///<reference path="rx.async-lite.d.ts" />
// Type alias for observables and promises
export type ObservableOrPromise<T> = IObservable<T> | Promise<T>;
declare module Rx {
interface ObservableStatic {
start<T>(func: () => T, context?: any, scheduler?: IScheduler): Observable<T>;
export type ArrayLike<T> = Array<T> | { length: number;[index: number]: T; };
// Type alias for arrays and array like objects
export type ArrayOrIterable<T> = ArrayLike<T>;
/**
* Promise A+
*/
export interface Promise<T> {
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected: (error: any) => Promise<R>): Promise<R>;
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected?: (error: any) => R): Promise<R>;
}
/**
* Promise A+
*/
export type IPromise<T> = Promise<T>;
/**
* Represents a push-style collection.
*/
export interface IObservable<T> { }
/**
* Represents a push-style collection.
*/
export interface Observable<T> { }
export interface ObservableStatic {
wrap<T>(fn: Function): Observable<T>;
spawn<T>(fn: Function): Observable<T>;
}
export interface IScheduler {
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedule(action: () => void): IDisposable;
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithState<TState>(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelative(dueTime: number, action: () => void): IDisposable;
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelativeAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;
}
export interface SchedulerStatic {
new (
now: () => number,
schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Rx.IScheduler;
/** Gets the current time according to the local machine's system clock. */
now: number;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
normalize(timeSpan: number): number;
}
/** Provides a set of static properties to access commonly used schedulers. */
export var Scheduler: SchedulerStatic;
export interface ObservableStatic {
/**
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
*
* @example
* var res = Rx.Observable.start(function () { console.log('hello'); });
* var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);
* var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console);
*
* @param {Function} func Function to run asynchronously.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*
* Remarks
* * The function is called immediately, not during the subscription of the resulting sequence.
* * Multiple subscriptions to the resulting sequence can observe the function's result.
*/
start<T>(func: () => T, scheduler?: IScheduler, context?: any): Observable<T>;
}
export interface ObservableStatic {
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
* @param {Function} function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
toAsync<TResult>(func: () => TResult, context?: any, scheduler?: IScheduler): () => Observable<TResult>;
toAsync<T1, TResult>(func: (arg1: T1) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1) => Observable<TResult>;
toAsync<T1, TResult>(func: (arg1?: T1) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1) => Observable<TResult>;
toAsync<T1, TResult>(func: (...args: T1[]) => TResult, context?: any, scheduler?: IScheduler): (...args: T1[]) => Observable<TResult>;
toAsync<T1, T2, TResult>(func: (arg1: T1, arg2: T2) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2) => Observable<TResult>;
toAsync<T1, T2, TResult>(func: (arg1: T1, arg2?: T2) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2?: T2) => Observable<TResult>;
toAsync<T1, T2, TResult>(func: (arg1?: T1, arg2?: T2) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, arg2?: T2) => Observable<TResult>;
toAsync<T1, T2, TResult>(func: (arg1: T1, ...args: T2[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, ...args: T2[]) => Observable<TResult>;
toAsync<T1, T2, TResult>(func: (arg1?: T1, ...args: T2[]) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, ...args: T2[]) => Observable<TResult>;
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3?: T3) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3?: T3) => Observable<TResult>;
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2?: T2, arg3?: T3) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2?: T2, arg3?: T3) => Observable<TResult>;
toAsync<T1, T2, T3, TResult>(func: (arg1?: T1, arg2?: T2, arg3?: T3) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, arg2?: T2, arg3?: T3) => Observable<TResult>;
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, ...args: T3[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, ...args: T3[]) => Observable<TResult>;
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2?: T2, ...args: T3[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2?: T2, ...args: T3[]) => Observable<TResult>;
toAsync<T1, T2, T3, TResult>(func: (arg1?: T1, arg2?: T2, ...args: T3[]) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, arg2?: T2, ...args: T3[]) => Observable<TResult>;
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Observable<TResult>;
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, arg4?: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3: T3, arg4?: T4) => Observable<TResult>;
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3?: T3, arg4?: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3?: T3, arg4?: T4) => Observable<TResult>;
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2?: T2, arg3?: T3, arg4?: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2?: T2, arg3?: T3, arg4?: T4) => Observable<TResult>;
toAsync<T1, T2, T3, T4, TResult>(func: (arg1?: T1, arg2?: T2, arg3?: T3, arg4?: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, arg2?: T2, arg3?: T3, arg4?: T4) => Observable<TResult>;
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, ...args: T4[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3: T3, ...args: T4[]) => Observable<TResult>;
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3?: T3, ...args: T4[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3?: T3, ...args: T4[]) => Observable<TResult>;
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => Observable<TResult>;
toAsync<T1, T2, T3, T4, TResult>(func: (arg1?: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => Observable<TResult>;
}
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
* @param {Function} function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
toAsync<T1, TResult>(func: (arg1: T1) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1) => Observable<TResult>;
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
* @param {Function} function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
toAsync<T1, T2, TResult>(func: (arg1: T1, arg2: T2) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2) => Observable<TResult>;
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
* @param {Function} function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
* @param {Function} function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Observable<TResult>;
}
export module config {
export var Promise: { new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise<T>; };
}
export module helpers {
export var noop: () => void;
export var notDefined: (value: any) => boolean;
export var identity: <T>(value: T) => T;
export var defaultNow: () => number;
export var defaultComparer: (left: any, right: any) => boolean;
export var defaultSubComparer: (left: any, right: any) => number;
export var defaultKeySerializer: (key: any) => string;
export var defaultError: (err: any) => void;
export var isPromise: (p: any) => boolean;
export var asArray: <T>(...args: T[]) => T[];
export var not: (value: any) => boolean;
export var isFunction: (value: any) => boolean;
}
export type _Selector<T, TResult> = (value: T, index: number, observable: Observable<T>) => TResult;
export type _ValueOrSelector<T, TResult> = TResult | _Selector<T, TResult>;
export type _Predicate<T> = _Selector<T, boolean>;
export type _Comparer<T, TResult> = (value1: T, value2: T) => TResult;
export type _Accumulator<T, TAcc> = (acc: TAcc, value: T) => TAcc;
export module special {
export type _FlatMapResultSelector<T1, T2, TResult> = (value: T1, selectorValue: T2, index: number, selectorOther: number) => TResult;
}
export interface IObservable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface Observable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable;
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface ObservableStatic {
/**
* Determines whether the given object is an Observable
* @param {Any} An object to determine whether it is an Observable
* @returns {Boolean} true if an Observable, else false.
*/
isObservable(o: any): boolean;
}
export var Observable: ObservableStatic;
export interface ObservableStatic {
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
fromCallback<TResult>(func: Function, context: any, selector: Function): (...args: any[]) => Observable<TResult>;
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
fromCallback<TResult, T1>(func: (arg1: T1, callback: (result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1) => Observable<TResult>;
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
fromCallback<TResult, T1, T2>(func: (arg1: T1, arg2: T2, callback: (result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2) => Observable<TResult>;
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
fromCallback<TResult, T1, T2, T3>(func: (arg1: T1, arg2: T2, arg3: T3, callback: (result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
fromCallback<TResult, T1, T2, T3, T4>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Observable<TResult>;
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
fromCallback<TResult, T1, T2, T3, T4, T5>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Observable<TResult>;
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
fromCallback<TResult, T1, T2, T3, T4, T5, T6>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Observable<TResult>;
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
fromCallback<TResult, T1, T2, T3, T4, T5, T6, T7>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, callback: (result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7) => Observable<TResult>;
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
fromCallback<TResult, T1, T2, T3, T4, T5, T6, T7, T8>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, callback: (result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8) => Observable<TResult>;
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
fromCallback<TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, callback: (result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9) => Observable<TResult>;
}
export interface ObservableStatic {
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
fromNodeCallback<TResult>(func: Function, context: any, selector: Function): (...args: any[]) => Observable<TResult>;
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
fromNodeCallback<TResult, T1>(func: (arg1: T1, callback: (err: any, result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1) => Observable<TResult>;
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
fromNodeCallback<TResult, T1, T2>(func: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2) => Observable<TResult>;
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
fromNodeCallback<TResult, T1, T2, T3>(func: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
fromNodeCallback<TResult, T1, T2, T3, T4>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Observable<TResult>;
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
fromNodeCallback<TResult, T1, T2, T3, T4, T5>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Observable<TResult>;
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
fromNodeCallback<TResult, T1, T2, T3, T4, T5, T6>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: any, result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Observable<TResult>;
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
fromNodeCallback<TResult, T1, T2, T3, T4, T5, T6, T7>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, callback: (err: any, result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7) => Observable<TResult>;
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
fromNodeCallback<TResult, T1, T2, T3, T4, T5, T6, T7, T8>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, callback: (err: any, result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8) => Observable<TResult>;
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
fromNodeCallback<TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, callback: (err: any, result: TResult) => any) => any, context?: any, selector?: Function): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9) => Observable<TResult>;
}
export interface ObservableStatic {
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
fromEvent<T>(element: NodeList, eventName: string, selector?: (arguments: any[]) => T): Observable<T>;
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
fromEvent<T>(element: Node, eventName: string, selector?: (arguments: any[]) => T): Observable<T>;
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
fromEvent<T>(element: { on: (name: string, cb: (e: any) => any) => void; off: (name: string, cb: (e: any) => any) => void }, eventName: string, selector?: (arguments: any[]) => T): Observable<T>;
}
export interface ObservableStatic {
/**
* Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.
* @param {Function} addHandler The function to add a handler to the emitter.
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
fromEventPattern<T>(addHandler: (handler: Function) => void, removeHandler: (handler: Function) => void, selector?: (arguments: any[]) => T): Observable<T>;
}
export interface ObservableStatic {
/**
* Invokes the asynchronous function, surfacing the result through an observable sequence.
* @param {Function} functionAsync Asynchronous function which returns a Promise to run.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*/
startAsync<T>(functionAsync: () => IPromise<T>): Observable<T>;
}
}
declare module "rx.async" {
export = Rx;
}
declare module "rx" { export = Rx; }
declare module "rx.async" { export = Rx; }

@@ -1,11 +0,358 @@

// Type definitions for RxJS-BackPressure v2.3.12
// Project: http://rx.codeplex.com/
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
///<reference path="rx.d.ts" />
///<reference path="rx.backpressure-lite.d.ts" />
// Type alias for observables and promises
export type ObservableOrPromise<T> = IObservable<T> | Promise<T>;
declare module "rx.backpressure" {
export = Rx;
export type ArrayLike<T> = Array<T> | { length: number;[index: number]: T; };
// Type alias for arrays and array like objects
export type ArrayOrIterable<T> = ArrayLike<T>;
/**
* Promise A+
*/
export interface Promise<T> {
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected: (error: any) => Promise<R>): Promise<R>;
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected?: (error: any) => R): Promise<R>;
}
/**
* Promise A+
*/
export type IPromise<T> = Promise<T>;
/**
* Represents a push-style collection.
*/
export interface IObservable<T> { }
/**
* Represents a push-style collection.
*/
export interface Observable<T> { }
/**
* Used to pause and resume streams.
*/
export interface Pauser {
/**
* Pauses the underlying sequence.
*/
pause(): void;
/**
* Resumes the underlying sequence.
*/
resume(): void;
}
export interface IScheduler {
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedule(action: () => void): IDisposable;
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithState<TState>(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelative(dueTime: number, action: () => void): IDisposable;
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelativeAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;
}
export interface SchedulerStatic {
new (
now: () => number,
schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Rx.IScheduler;
/** Gets the current time according to the local machine's system clock. */
now: number;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
normalize(timeSpan: number): number;
}
/** Provides a set of static properties to access commonly used schedulers. */
export var Scheduler: SchedulerStatic;
export interface Observable<T> {
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausable(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
pausable(pauser?: Observable<boolean>): PausableObservable<T>;
}
export interface PausableObservable<T> extends Observable<T> {
pause(): void;
resume(): void;
}
export interface Observable<T> {
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
* and yields the values that were buffered while paused.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausableBuffered(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
pausableBuffered(pauser?: Observable<boolean>): PausableObservable<T>;
}
export interface IDisposable {
dispose(): void;
}
export interface Disposable extends IDisposable {
/** Is this value disposed. */
isDisposed?: boolean;
}
interface DisposableStatic {
/**
* Provides a set of static methods for creating Disposables.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
new (action: () => void): Disposable;
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
create(action: () => void): Disposable;
/**
* Gets the disposable that does nothing when disposed.
*/
empty: IDisposable;
/**
* Validates whether the given object is a disposable
* @param {Object} Object to test whether it has a dispose method
* @returns {Boolean} true if a disposable object, else false.
*/
isDisposable(d: any): boolean;
}
/**
* Provides a set of static methods for creating Disposables.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
export var Disposable: DisposableStatic;
export interface Observable<T> {
/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {bool} enableQueue truthy value to determine if values should be queued pending the next request
* @param {Scheduler} scheduler determines how the requests will be scheduled
* @returns {Observable} The observable sequence which only propagates values on request.
*/
controlled(enableQueue?: boolean, scheduler?: IScheduler): ControlledObservable<T>;
}
export interface ControlledObservable<T> extends Observable<T> {
request(numberOfItems?: number): IDisposable;
}
export interface ControlledObservable<T> {
/**
* Attaches a stop and wait observable to the current observable.
* @returns {Observable} A stop and wait observable.
*/
stopAndWait(): Observable<T>;
}
export interface ControlledObservable<T> {
/**
* Creates a sliding windowed observable based upon the window size.
* @param {Number} windowSize The number of items in the window
* @returns {Observable} A windowed observable based upon the window size.
*/
windowed(windowSize: number): Observable<T>;
}
export module config {
export var Promise: { new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise<T>; };
}
export module helpers {
export var noop: () => void;
export var notDefined: (value: any) => boolean;
export var identity: <T>(value: T) => T;
export var defaultNow: () => number;
export var defaultComparer: (left: any, right: any) => boolean;
export var defaultSubComparer: (left: any, right: any) => number;
export var defaultKeySerializer: (key: any) => string;
export var defaultError: (err: any) => void;
export var isPromise: (p: any) => boolean;
export var asArray: <T>(...args: T[]) => T[];
export var not: (value: any) => boolean;
export var isFunction: (value: any) => boolean;
}
export type _Selector<T, TResult> = (value: T, index: number, observable: Observable<T>) => TResult;
export type _ValueOrSelector<T, TResult> = TResult | _Selector<T, TResult>;
export type _Predicate<T> = _Selector<T, boolean>;
export type _Comparer<T, TResult> = (value1: T, value2: T) => TResult;
export type _Accumulator<T, TAcc> = (acc: TAcc, value: T) => TAcc;
export module special {
export type _FlatMapResultSelector<T1, T2, TResult> = (value: T1, selectorValue: T2, index: number, selectorOther: number) => TResult;
}
export interface IObservable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface Observable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable;
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface ObservableStatic {
/**
* Determines whether the given object is an Observable
* @param {Any} An object to determine whether it is an Observable
* @returns {Boolean} true if an Observable, else false.
*/
isObservable(o: any): boolean;
}
export var Observable: ObservableStatic;
export interface Observable<T> {
/**
* Pipes the existing Observable sequence into a Node.js Stream.
* @param {Stream} dest The destination Node.js stream.
* @returns {Stream} The destination stream.
*/
pipe<TDest>(dest: TDest): TDest;
// TODO: Add link to node.d.ts some where
}
}
declare module "rx" { export = Rx; }
declare module "rx.backpressure" { export = Rx; }

@@ -1,11 +0,398 @@

// Type definitions for RxJS-Binding v2.2.28
// Project: http://rx.codeplex.com/
// Definitions by: Carl de Billy <http://carl.debilly.net/>, Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
///<reference path="rx.d.ts" />
///<reference path="rx.binding-lite.d.ts" />
// Type alias for observables and promises
export type ObservableOrPromise<T> = IObservable<T> | Promise<T>;
declare module "rx.binding" {
export = Rx;
export type ArrayLike<T> = Array<T> | { length: number;[index: number]: T; };
// Type alias for arrays and array like objects
export type ArrayOrIterable<T> = ArrayLike<T>;
/**
* Promise A+
*/
export interface Promise<T> {
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected: (error: any) => Promise<R>): Promise<R>;
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected?: (error: any) => R): Promise<R>;
}
/**
* Promise A+
*/
export type IPromise<T> = Promise<T>;
/**
* Represents a push-style collection.
*/
export interface IObservable<T> { }
/**
* Represents a push-style collection.
*/
export interface Observable<T> { }
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
export interface ISubject<T> extends IObservable<T>, IObserver<T>, IDisposable {
hasObservers(): boolean;
}
export interface Subject<T> extends Observable<T>, Observer<T>, IDisposable {
hasObservers(): boolean;
/** Is this value disposed. */
isDisposed: boolean;
}
interface SubjectStatic {
/**
* Creates a subject.
*/
new <T>(): Subject<T>;
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
create<T>(observer?: IObserver<T>, observable?: IObservable<T>): Subject<T>;
}
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
export var Subject: SubjectStatic;
export interface ConnectableObservable<T> extends Observable<T> {
connect(): IDisposable;
refCount(): Observable<T>;
}
export interface Observable<T> {
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
multicast(subject: ISubject<T> | (() => ISubject<T>)): ConnectableObservable<T>;
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
multicast<TResult>(subjectSelector: ISubject<T> | (() => ISubject<T>), selector: (source: ConnectableObservable<T>) => Observable<T>): Observable<T>;
}
export interface Observable<T> {
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
publish(): ConnectableObservable<T>;
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
publish<TResult>(selector: (source: ConnectableObservable<T>) => Observable<TResult>): Observable<TResult>;
}
export interface Observable<T> {
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
share(): Observable<T>;
}
export interface Observable<T> {
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
publishLast(): ConnectableObservable<T>;
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
publishLast<TResult>(selector: (source: ConnectableObservable<T>) => Observable<TResult>): Observable<TResult>;
}
export interface Observable<T> {
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
publishValue(initialValue: T): ConnectableObservable<T>;
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
publishValue<TResult>(selector: (source: ConnectableObservable<T>) => Observable<TResult>, initialValue: T): Observable<TResult>;
}
export interface Observable<T> {
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
shareValue(initialValue: T): Observable<T>;
}
export interface IScheduler {
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedule(action: () => void): IDisposable;
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithState<TState>(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelative(dueTime: number, action: () => void): IDisposable;
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelativeAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;
}
export interface SchedulerStatic {
new (
now: () => number,
schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Rx.IScheduler;
/** Gets the current time according to the local machine's system clock. */
now: number;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
normalize(timeSpan: number): number;
}
/** Provides a set of static properties to access commonly used schedulers. */
export var Scheduler: SchedulerStatic;
export interface Observable<T> {
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param windowSize [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
replay(selector?: void, bufferSize?: number, window?: number, scheduler?: IScheduler): ConnectableObservable<T>; // hack to catch first omitted parameter
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param windowSize [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
replay(selector: (source: ConnectableObservable<T>) => Observable<T>, bufferSize?: number, window?: number, scheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareReplay(3);
* var res = source.shareReplay(3, 500);
* var res = source.shareReplay(3, 500, scheduler);
*
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
shareReplay(bufferSize?: number, window?: number, scheduler?: IScheduler): Observable<T>;
}
export interface BehaviorSubject<T> extends Subject<T> {
/**
* Gets the current value or throws an exception.
* Value is frozen after onCompleted is called.
* After onError is called always throws the specified exception.
* An exception is always thrown after dispose is called.
* @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext.
*/
getValue(): T;
}
interface BehaviorSubjectStatic {
/**
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
*/
new <T>(initialValue: T): BehaviorSubject<T>;
}
/**
* Represents a value that changes over time.
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
*/
export var BehaviorSubject: BehaviorSubjectStatic;
export interface ReplaySubject<T> extends Subject<T> { }
interface ReplaySubjectStatic {
/**
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
* @param {Number} [windowSize] Maximum time length of the replay buffer.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/
new <T>(bufferSize?: number, window?: number, scheduler?: IScheduler): ReplaySubject<T>;
}
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
*/
export var ReplaySubject: ReplaySubjectStatic;
export interface Observable<T> {
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence
* can be resubscribed to, even if all prior subscriptions have ended. (unlike `.publish().refCount()`)
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source.
*/
singleInstance(): Observable<T>;
}
}
declare module "rx" { export = Rx; }
declare module "rx.binding" { export = Rx; }

@@ -1,36 +0,318 @@

// Type definitions for RxJS-Coincidence v2.2.28
// Project: http://rx.codeplex.com/
// Definitions by: Carl de Billy <http://carl.debilly.net/>, Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
///<reference path="rx.d.ts" />
///<reference path="rx.coincidence-lite.d.ts" />
// Type alias for observables and promises
export type ObservableOrPromise<T> = IObservable<T> | Promise<T>;
declare module Rx {
export type ArrayLike<T> = Array<T> | { length: number;[index: number]: T; };
interface Observable<T> {
join<TRight, TDurationLeft, TDurationRight, TResult>(
right: Observable<TRight>,
leftDurationSelector: (leftItem: T) => Observable<TDurationLeft>,
rightDurationSelector: (rightItem: TRight) => Observable<TDurationRight>,
resultSelector: (leftItem: T, rightItem: TRight) => TResult): Observable<TResult>;
// Type alias for arrays and array like objects
export type ArrayOrIterable<T> = ArrayLike<T>;
groupJoin<TRight, TDurationLeft, TDurationRight, TResult>(
right: Observable<TRight>,
leftDurationSelector: (leftItem: T) => Observable<TDurationLeft>,
rightDurationSelector: (rightItem: TRight) => Observable<TDurationRight>,
resultSelector: (leftItem: T, rightItem: Observable<TRight>) => TResult): Observable<TResult>;
/**
* Promise A+
*/
export interface Promise<T> {
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected: (error: any) => Promise<R>): Promise<R>;
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected?: (error: any) => R): Promise<R>;
}
window<TWindowOpening>(windowOpenings: Observable<TWindowOpening>): Observable<Observable<T>>;
window<TWindowClosing>(windowClosingSelector: () => Observable<TWindowClosing>): Observable<Observable<T>>;
window<TWindowOpening, TWindowClosing>(windowOpenings: Observable<TWindowOpening>, windowClosingSelector: () => Observable<TWindowClosing>): Observable<Observable<T>>;
/**
* Promise A+
*/
export type IPromise<T> = Promise<T>;
buffer<TBufferOpening>(bufferOpenings: Observable<TBufferOpening>): Observable<T[]>;
buffer<TBufferClosing>(bufferClosingSelector: () => Observable<TBufferClosing>): Observable<T[]>;
buffer<TBufferOpening, TBufferClosing>(bufferOpenings: Observable<TBufferOpening>, bufferClosingSelector: () => Observable<TBufferClosing>): Observable<T[]>;
}
/**
* Represents a push-style collection.
*/
export interface IObservable<T> { }
/**
* Represents a push-style collection.
*/
export interface Observable<T> { }
export module config {
export var Promise: { new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise<T>; };
}
export module helpers {
export var noop: () => void;
export var notDefined: (value: any) => boolean;
export var identity: <T>(value: T) => T;
export var defaultNow: () => number;
export var defaultComparer: (left: any, right: any) => boolean;
export var defaultSubComparer: (left: any, right: any) => number;
export var defaultKeySerializer: (key: any) => string;
export var defaultError: (err: any) => void;
export var isPromise: (p: any) => boolean;
export var asArray: <T>(...args: T[]) => T[];
export var not: (value: any) => boolean;
export var isFunction: (value: any) => boolean;
}
export type _Selector<T, TResult> = (value: T, index: number, observable: Observable<T>) => TResult;
export type _ValueOrSelector<T, TResult> = TResult | _Selector<T, TResult>;
export type _Predicate<T> = _Selector<T, boolean>;
export type _Comparer<T, TResult> = (value1: T, value2: T) => TResult;
export type _Accumulator<T, TAcc> = (acc: TAcc, value: T) => TAcc;
export module special {
export type _FlatMapResultSelector<T1, T2, TResult> = (value: T1, selectorValue: T2, index: number, selectorOther: number) => TResult;
}
export interface IObservable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface Observable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable;
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface ObservableStatic {
/**
* Determines whether the given object is an Observable
* @param {Any} An object to determine whether it is an Observable
* @returns {Boolean} true if an Observable, else false.
*/
isObservable(o: any): boolean;
}
export var Observable: ObservableStatic;
export interface Observable<T> {
/**
* Correlates the elements of two sequences based on overlapping durations.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
join<TRight, TDurationLeft, TDurationRight, TResult>(
right: Observable<TRight>,
leftDurationSelector: (leftItem: T) => Observable<TDurationLeft>,
rightDurationSelector: (rightItem: TRight) => Observable<TDurationRight>,
resultSelector: (leftItem: T, rightItem: TRight) => TResult): Observable<TResult>;
}
export interface Observable<T> {
/**
* Groups the elements of an observable sequence according to a specified key selector function.
* A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
*
* @example
* var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} durationSelector A function to signal the expiration of a group.
* @returns {Observable}
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
* If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
*
*/
groupByUntil<TKey, TDuration>(keySelector: (value: T) => TKey, skipElementSelector: boolean, durationSelector: (group: GroupedObservable<TKey, T>) => Observable<TDuration>, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, T>>;
/**
* Groups the elements of an observable sequence according to a specified key selector function.
* A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
*
* @example
* var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never();
export interface Observable<T> {
/**
* Correlates the elements of two sequences based on overlapping durations, and groups the results.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
groupJoin<TRight, TDurationLeft, TDurationRight, TResult>(
right: Observable<TRight>,
leftDurationSelector: (leftItem: T) => Observable<TDurationLeft>,
rightDurationSelector: (rightItem: TRight) => Observable<TDurationRight>,
resultSelector: (leftItem: T, rightItem: Observable<TRight>) => TResult): Observable<TResult>;
}
export interface Observable<T> {
/**
* Projects each element of an observable sequence into zero or more buffers.
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
buffer<TBufferOpening>(bufferOpenings: Observable<TBufferOpening>): Observable<T[]>;
/**
* Projects each element of an observable sequence into zero or more buffers.
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
buffer<TBufferClosing>(bufferClosingSelector: () => Observable<TBufferClosing>): Observable<T[]>;
/**
* Projects each element of an observable sequence into zero or more buffers.
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
buffer<TBufferOpening, TBufferClosing>(bufferOpenings: Observable<TBufferOpening>, bufferClosingSelector: () => Observable<TBufferClosing>): Observable<T[]>;
}
export interface Observable<T> {
/**
* Projects each element of an observable sequence into zero or more windows.
*
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
window<TWindowOpening>(windowOpenings: Observable<TWindowOpening>): Observable<Observable<T>>;
/**
* Projects each element of an observable sequence into zero or more windows.
*
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
window<TWindowClosing>(windowClosingSelector: () => Observable<TWindowClosing>): Observable<Observable<T>>;
/**
* Projects each element of an observable sequence into zero or more windows.
*
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
window<TWindowOpening, TWindowClosing>(windowOpenings: Observable<TWindowOpening>, windowClosingSelector: () => Observable<TWindowClosing>): Observable<Observable<T>>;
}
export interface Observable<T> {
/**
* Returns a new observable that triggers on the second and subsequent triggerings of the input observable.
* The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.
* The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.
* @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array.
*/
pairwise(): Observable<[T, T]>;
}
export interface Observable<T> {
/**
* Returns two observables which partition the observations of the source by the given function.
* The first will trigger observations for those values for which the predicate returns true.
* The second will trigger observations for those values where the predicate returns false.
* The predicate is executed once for each subscribed observer.
* Both also propagate all error observations arising from the source and each completes
* when the source completes.
* @param {Function} predicate
* The function to determine which output Observable will trigger a particular observation.
* @returns {Array}
* An array of observables. The first triggers when the predicate returns true,
* and the second triggers when the predicate returns false.
*/
partition(predicate: _Predicate<T>, thisArg?: any): [Observable<T>, Observable<T>];
}
export interface Observable<T> {
/**
* Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
*
* @example
* var res = observable.groupBy(function (x) { return x.id; });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
* @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
*/
groupBy<TKey, TElement>(keySelector: (value: T) => TKey, skipElementSelector?: boolean, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, T>>;
/**
* Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
*
* @example
* var res = observable.groupBy(function (x) { return x.id; });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name;
export interface GroupedObservable<TKey, TElement> extends Observable<TElement> {
key: TKey;
underlyingObservable: Observable<TElement>;
}
}
declare module "rx.coincidence" {
export = Rx;
}
declare module "rx" { export = Rx; }
declare module "rx.coincidence" { export = Rx; }

@@ -1,321 +0,646 @@

// Type definitions for RxJS-Experimental v2.2.28
// Project: https://github.com/Reactive-Extensions/RxJS/
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
/// <reference path="rx.d.ts"/>
// Type alias for observables and promises
export type ObservableOrPromise<T> = IObservable<T> | Promise<T>;
declare module Rx {
export type ArrayLike<T> = Array<T> | { length: number;[index: number]: T; };
interface Observable<T> {
/**
* Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
* This operator allows for a fluent style of writing queries that use the same sequence multiple times.
*
* @param selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @returns An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
let<TResult>(selector: (source: Observable<T>) => Observable<TResult>): Observable<TResult>;
// Type alias for arrays and array like objects
export type ArrayOrIterable<T> = ArrayLike<T>;
/**
* Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
* This operator allows for a fluent style of writing queries that use the same sequence multiple times.
*
* @param selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @returns An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
letBind<TResult>(selector: (source: Observable<T>) => Observable<TResult>): Observable<TResult>;
/**
* Promise A+
*/
export interface Promise<T> {
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected: (error: any) => Promise<R>): Promise<R>;
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected?: (error: any) => R): Promise<R>;
}
/**
* Repeats source as long as condition holds emulating a do while loop.
* @param condition The condition which determines if the source will be repeated.
* @returns An observable sequence which is repeated as long as the condition holds.
*/
doWhile(condition: () => boolean): Observable<T>;
/**
* Promise A+
*/
export type IPromise<T> = Promise<T>;
/**
* Expands an observable sequence by recursively invoking selector.
*
* @param selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @returns An observable sequence containing all the elements produced by the recursive expansion.
*/
expand(selector: (item: T) => Observable<T>, scheduler?: IScheduler): Observable<T>;
/**
* Represents a push-style collection.
*/
export interface IObservable<T> { }
/**
* Runs two observable sequences in parallel and combines their last elemenets.
*
* @param second Second observable sequence or promise.
* @param resultSelector Result selector function to invoke with the last elements of both sequences.
* @returns An observable sequence with the result of calling the selector function with the last elements of both input sequences.
*/
forkJoin<TSecond, TResult>(second: Observable<TSecond>, resultSelector: (left: T, right: TSecond) => TResult): Observable<TResult>;
forkJoin<TSecond, TResult>(second: IPromise<TSecond>, resultSelector: (left: T, right: TSecond) => TResult): Observable<TResult>;
/**
* Represents a push-style collection.
*/
export interface Observable<T> { }
/**
* Comonadic bind operator.
* @param selector A transform function to apply to each element.
* @param [scheduler] Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
* @returns An observable sequence which results from the comonadic bind operation.
*/
manySelect<TResult>(selector: (item: Observable<T>, index: number, source: Observable<T>) => TResult, scheduler?: IScheduler): Observable<TResult>;
}
export module config {
export var Promise: { new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise<T>; };
}
interface ObservableStatic {
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* res = Rx.Observable.if(condition, obs1, obs2);
* @param condition The condition which determines if the thenSource or elseSource will be run.
* @param thenSource The observable sequence or promise that will be run if the condition function returns true.
* @param elseSource The observable sequence or promise that will be run if the condition function returns false.
* @returns An observable sequence which is either the thenSource or elseSource.
*/
if<T>(condition: () => boolean, thenSource: Observable<T>, elseSource: Observable<T>): Observable<T>;
if<T>(condition: () => boolean, thenSource: Observable<T>, elseSource: IPromise<T>): Observable<T>;
if<T>(condition: () => boolean, thenSource: IPromise<T>, elseSource: Observable<T>): Observable<T>;
if<T>(condition: () => boolean, thenSource: IPromise<T>, elseSource: IPromise<T>): Observable<T>;
export module helpers {
export var noop: () => void;
export var notDefined: (value: any) => boolean;
export var identity: <T>(value: T) => T;
export var defaultNow: () => number;
export var defaultComparer: (left: any, right: any) => boolean;
export var defaultSubComparer: (left: any, right: any) => number;
export var defaultKeySerializer: (key: any) => string;
export var defaultError: (err: any) => void;
export var isPromise: (p: any) => boolean;
export var asArray: <T>(...args: T[]) => T[];
export var not: (value: any) => boolean;
export var isFunction: (value: any) => boolean;
}
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* res = Rx.Observable.if(condition, obs1, scheduler);
* @param condition The condition which determines if the thenSource or empty sequence will be run.
* @param thenSource The observable sequence or promise that will be run if the condition function returns true.
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
* @returns An observable sequence which is either the thenSource or empty sequence.
*/
if<T>(condition: () => boolean, thenSource: Observable<T>, scheduler?: IScheduler): Observable<T>;
if<T>(condition: () => boolean, thenSource: IPromise<T>, scheduler?: IScheduler): Observable<T>;
export type _Selector<T, TResult> = (value: T, index: number, observable: Observable<T>) => TResult;
export type _ValueOrSelector<T, TResult> = TResult | _Selector<T, TResult>;
export type _Predicate<T> = _Selector<T, boolean>;
export type _Comparer<T, TResult> = (value1: T, value2: T) => TResult;
export type _Accumulator<T, TAcc> = (acc: TAcc, value: T) => TAcc;
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* res = Rx.Observable.if(condition, obs1, obs2);
* @param condition The condition which determines if the thenSource or elseSource will be run.
* @param thenSource The observable sequence or promise that will be run if the condition function returns true.
* @param elseSource The observable sequence or promise that will be run if the condition function returns false.
* @returns An observable sequence which is either the thenSource or elseSource.
*/
ifThen<T>(condition: () => boolean, thenSource: Observable<T>, elseSource: Observable<T>): Observable<T>;
ifThen<T>(condition: () => boolean, thenSource: Observable<T>, elseSource: IPromise<T>): Observable<T>;
ifThen<T>(condition: () => boolean, thenSource: IPromise<T>, elseSource: Observable<T>): Observable<T>;
ifThen<T>(condition: () => boolean, thenSource: IPromise<T>, elseSource: IPromise<T>): Observable<T>;
export module special {
export type _FlatMapResultSelector<T1, T2, TResult> = (value: T1, selectorValue: T2, index: number, selectorOther: number) => TResult;
}
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* res = Rx.Observable.if(condition, obs1, scheduler);
* @param condition The condition which determines if the thenSource or empty sequence will be run.
* @param thenSource The observable sequence or promise that will be run if the condition function returns true.
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
* @returns An observable sequence which is either the thenSource or empty sequence.
*/
ifThen<T>(condition: () => boolean, thenSource: Observable<T>, scheduler?: IScheduler): Observable<T>;
ifThen<T>(condition: () => boolean, thenSource: IPromise<T>, scheduler?: IScheduler): Observable<T>;
export interface IObservable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
/**
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @param sources An array of values to turn into an observable sequence.
* @param resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns An observable sequence from the concatenated observable sequences.
*/
for<T, TResult>(sources: T[], resultSelector: (item: T) => Observable<TResult>): Observable<TResult>;
export interface Observable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
/**
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @param sources An array of values to turn into an observable sequence.
* @param resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns An observable sequence from the concatenated observable sequences.
*/
forIn<T, TResult>(sources: T[], resultSelector: (item: T) => Observable<TResult>): Observable<TResult>;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable;
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable;
/**
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
* @param condition The condition which determines if the source will be repeated.
* @param source The observable sequence or promise that will be run if the condition function returns true.
* @returns An observable sequence which is repeated as long as the condition holds.
*/
while<T>(condition: () => boolean, source: Observable<T>): Observable<T>;
while<T>(condition: () => boolean, source: IPromise<T>): Observable<T>;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(observer: IObserver<T>): IDisposable;
/**
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
* @param condition The condition which determines if the source will be repeated.
* @param source The observable sequence or promise that will be run if the condition function returns true.
* @returns An observable sequence which is repeated as long as the condition holds.
*/
whileDo<T>(condition: () => boolean, source: Observable<T>): Observable<T>;
whileDo<T>(condition: () => boolean, source: IPromise<T>): Observable<T>;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
*
* @returns An observable sequence which is determined by a case statement.
*/
case<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
case<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
case<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, elseSource: IPromise<T>): Observable<T>;
case<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, elseSource: IPromise<T>): Observable<T>;
export interface ObservableStatic {
/**
* Determines whether the given object is an Observable
* @param {Any} An object to determine whether it is an Observable
* @returns {Boolean} true if an Observable, else false.
*/
isObservable(o: any): boolean;
}
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
*
* @returns An observable sequence which is determined by a case statement.
*/
case<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
case<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
export var Observable: ObservableStatic;
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
*
* @returns An observable sequence which is determined by a case statement.
*/
case<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
case<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
case<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, elseSource: IPromise<T>): Observable<T>;
case<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, elseSource: IPromise<T>): Observable<T>;
export interface Observable<T> {
/**
* Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
* This operator allows for a fluent style of writing queries that use the same sequence multiple times.
*
* @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
let<TResult>(selector: (source: Observable<T>) => Observable<TResult>): Observable<TResult>;
}
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
*
* @returns An observable sequence which is determined by a case statement.
*/
case<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
case<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
export interface IScheduler {
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedule(action: () => void): IDisposable;
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
*
* @returns An observable sequence which is determined by a case statement.
*/
switchCase<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
switchCase<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
switchCase<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, elseSource: IPromise<T>): Observable<T>;
switchCase<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, elseSource: IPromise<T>): Observable<T>;
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithState<TState>(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
*
* @returns An observable sequence which is determined by a case statement.
*/
switchCase<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
switchCase<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelative(dueTime: number, action: () => void): IDisposable;
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
*
* @returns An observable sequence which is determined by a case statement.
*/
switchCase<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
switchCase<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
switchCase<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, elseSource: IPromise<T>): Observable<T>;
switchCase<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, elseSource: IPromise<T>): Observable<T>;
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelativeAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
*
* @returns An observable sequence which is determined by a case statement.
*/
switchCase<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
switchCase<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* res = Rx.Observable.forkJoin([obs1, obs2]);
* @param sources Array of source sequences or promises.
* @returns An observable sequence with an array collecting the last elements of all the input sequences.
*/
forkJoin<T>(sources: Observable<T>[]): Observable<T[]>;
forkJoin<T>(sources: IPromise<T>[]): Observable<T[]>;
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;
}
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @param args Source sequences or promises.
* @returns An observable sequence with an array collecting the last elements of all the input sequences.
*/
forkJoin<T>(...args: Observable<T>[]): Observable<T[]>;
forkJoin<T>(...args: IPromise<T>[]): Observable<T[]>;
}
export interface SchedulerStatic {
new (
now: () => number,
schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Rx.IScheduler;
/** Gets the current time according to the local machine's system clock. */
now: number;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
normalize(timeSpan: number): number;
}
/** Provides a set of static properties to access commonly used schedulers. */
export var Scheduler: SchedulerStatic;
export interface ObservableStatic {
/**
* Determines whether an observable collection contains values.
*
* @example
* 1 - res = Rx.Observable.if(condition, obs1);
* 2 - res = Rx.Observable.if(condition, obs1, obs2);
* 3 - res = Rx.Observable.if(condition, obs1, scheduler);
* @param {Function} condition The condition which determines if the thenSource or elseSource will be run.
* @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
* @returns {Observable} An observable sequence which is either the thenSource or elseSource.
*/
if<T>(condition: () => boolean, thenSource: ObservableOrPromise<T>, elseSourceOrScheduler?: ObservableOrPromise<T> | IScheduler): Observable<T>;
}
export interface ObservableStatic {
/**
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @param {Array} sources An array of values to turn into an observable sequence.
* @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns {Observable} An observable sequence from the concatenated observable sequences.
*/
for<T, TResult>(sources: T[], resultSelector: _Selector<T, TResult>, thisArg?: any): Observable<TResult>;
/**
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @param {Array} sources An array of values to turn into an observable sequence.
* @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns {Observable} An observable sequence from the concatenated observable sequences.
*/
forIn<T, TResult>(sources: T[], resultSelector: _Selector<T, TResult>, thisArg?: any): Observable<TResult>;
}
export interface ObservableStatic {
/**
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
while<T>(condition: () => boolean, source: ObservableOrPromise<T>): Observable<T>;
/**
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
whileDo<T>(condition: () => boolean, source: ObservableOrPromise<T>): Observable<T>;
}
export interface Observable<T> {
/**
* Repeats source as long as condition holds emulating a do while loop.
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
doWhile(condition: () => boolean): Observable<T>;
}
export interface ObservableStatic {
/**
* Uses selector to determine which source in sources to use.
* @param {Function} selector The function which extracts the value for to test in a case statement.
* @param {Array} sources A object which has keys which correspond to the case statement labels.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
*
* @returns {Observable} An observable sequence which is determined by a case statement.
*/
case<T>(selector: () => string, sources: { [key: string]: ObservableOrPromise<T>; }, schedulerOrElseSource?: IScheduler | ObservableOrPromise<T>): Observable<T>;
/**
* Uses selector to determine which source in sources to use.
* @param {Function} selector The function which extracts the value for to test in a case statement.
* @param {Array} sources A object which has keys which correspond to the case statement labels.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
*
* @returns {Observable} An observable sequence which is determined by a case statement.
*/
case<T>(selector: () => number, sources: { [key: number]: ObservableOrPromise<T>; }, schedulerOrElseSource?: IScheduler | ObservableOrPromise<T>): Observable<T>;
}
export interface Observable<T> {
/**
* Expands an observable sequence by recursively invoking selector.
*
* @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.
*/
expand(selector: (item: T) => Observable<T>, scheduler?: IScheduler): Observable<T>;
}
export interface ObservableStatic {
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
*/
forkJoin<T>(sources: ObservableOrPromise<T>[]): Observable<T[]>;
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
*/
forkJoin<T>(...args: ObservableOrPromise<T>[]): Observable<T[]>;
}
export interface Observable<T> {
/**
* Runs two observable sequences in parallel and combines their last elemenets.
*
* @param {Observable} second Second observable sequence.
* @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.
* @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.
*/
forkJoin<TSecond, TResult>(second: ObservableOrPromise<TSecond>, resultSelector: (left: T, right: TSecond) => TResult): Observable<TResult>;
}
export interface Observable<T> {
/**
* Comonadic bind operator.
* @param {Function} selector A transform function to apply to each element.
* @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
* @returns {Observable} An observable sequence which results from the comonadic bind operation.
*/
manySelect<TResult>(selector: _Selector<Observable<T>, TResult>, scheduler?: IScheduler): Observable<TResult>;
/**
* Comonadic bind operator.
* @param {Function} selector A transform function to apply to each element.
* @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
* @returns {Observable} An observable sequence which results from the comonadic bind operation.
*/
extend<TResult>(selector: _Selector<Observable<T>, TResult>, scheduler?: IScheduler): Observable<TResult>;
}
export interface Observable<T> {
/**
* 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.
*/
switchFirst(): T;
}
export interface Observable<T> {
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
*/
selectSwitchFirst<TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TResult>>): Observable<TResult>;
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
*/
selectSwitchFirst<TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TResult>>): Observable<TResult>;
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
*/
selectSwitchFirst<TOther, TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
*/
selectSwitchFirst<TOther, TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
*/
flatMapFirst<TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TResult>>): Observable<TResult>;
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
*/
flatMapFirst<TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TResult>>): Observable<TResult>;
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
*/
flatMapFirst<TOther, TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
*/
flatMapFirst<TOther, TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
}
export interface Observable<T> {
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
selectManyWithMaxConcurrent<TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ObservableOrPromise<TResult>>): Observable<TResult>;
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
selectManyWithMaxConcurrent<TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ArrayOrIterable<TResult>>): Observable<TResult>;
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
selectManyWithMaxConcurrent<TOther, TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ObservableOrPromise<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
selectManyWithMaxConcurrent<TOther, TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ArrayOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
flatMapWithMaxConcurrent<TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ObservableOrPromise<TResult>>): Observable<TResult>;
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
flatMapWithMaxConcurrent<TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ArrayOrIterable<TResult>>): Observable<TResult>;
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
flatMapWithMaxConcurrent<TOther, TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ObservableOrPromise<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
flatMapWithMaxConcurrent<TOther, TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ArrayOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
}
}
declare module "rx.experimental" {
export = Rx;
}
declare module "rx" { export = Rx; }
declare module "rx.experimental" { export = Rx; }

@@ -1,60 +0,294 @@

// Type definitions for RxJS-Join v2.2.28
// Project: http://rx.codeplex.com/
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
///<reference path="rx.d.ts" />
// Type alias for observables and promises
export type ObservableOrPromise<T> = IObservable<T> | Promise<T>;
declare module Rx {
export type ArrayLike<T> = Array<T> | { length: number;[index: number]: T; };
interface Pattern1<T1> {
and<T2>(other: Observable<T2>): Pattern2<T1, T2>;
thenDo<TR>(selector: (item1: T1) => TR): Plan<TR>;
}
interface Pattern2<T1, T2> {
and<T3>(other: Observable<T3>): Pattern3<T1, T2, T3>;
thenDo<TR>(selector: (item1: T1, item2: T2) => TR): Plan<TR>;
}
interface Pattern3<T1, T2, T3> {
and<T4>(other: Observable<T4>): Pattern4<T1, T2, T3, T4>;
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3) => TR): Plan<TR>;
}
interface Pattern4<T1, T2, T3, T4> {
and<T5>(other: Observable<T5>): Pattern5<T1, T2, T3, T4, T5>;
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4) => TR): Plan<TR>;
}
interface Pattern5<T1, T2, T3, T4, T5> {
and<T6>(other: Observable<T6>): Pattern6<T1, T2, T3, T4, T5, T6>;
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5) => TR): Plan<TR>;
}
interface Pattern6<T1, T2, T3, T4, T5, T6> {
and<T7>(other: Observable<T7>): Pattern7<T1, T2, T3, T4, T5, T6, T7>;
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6) => TR): Plan<TR>;
}
interface Pattern7<T1, T2, T3, T4, T5, T6, T7> {
and<T8>(other: Observable<T8>): Pattern8<T1, T2, T3, T4, T5, T6, T7, T8>;
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6, item7: T7) => TR): Plan<TR>;
}
interface Pattern8<T1, T2, T3, T4, T5, T6, T7, T8> {
and<T9>(other: Observable<T9>): Pattern9<T1, T2, T3, T4, T5, T6, T7, T8, T9>;
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6, item7: T7, item8: T8) => TR): Plan<TR>;
}
interface Pattern9<T1, T2, T3, T4, T5, T6, T7, T8, T9> {
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6, item7: T7, item8: T8, item9: T9) => TR): Plan<TR>;
}
// Type alias for arrays and array like objects
export type ArrayOrIterable<T> = ArrayLike<T>;
interface Plan<T> { }
/**
* Promise A+
*/
export interface Promise<T> {
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected: (error: any) => Promise<R>): Promise<R>;
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected?: (error: any) => R): Promise<R>;
}
interface Observable<T> {
and<T2>(other: Observable<T2>): Pattern2<T, T2>;
thenDo<TR>(selector: (item1: T) => TR): Plan<TR>;
}
/**
* Promise A+
*/
export type IPromise<T> = Promise<T>;
interface ObservableStatic {
when<TR>(plan: Plan<TR>): Observable<TR>;
}
/**
* Represents a push-style collection.
*/
export interface IObservable<T> { }
/**
* Represents a push-style collection.
*/
export interface Observable<T> { }
export class Plan<T> { }
export module config {
export var Promise: { new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise<T>; };
}
export module helpers {
export var noop: () => void;
export var notDefined: (value: any) => boolean;
export var identity: <T>(value: T) => T;
export var defaultNow: () => number;
export var defaultComparer: (left: any, right: any) => boolean;
export var defaultSubComparer: (left: any, right: any) => number;
export var defaultKeySerializer: (key: any) => string;
export var defaultError: (err: any) => void;
export var isPromise: (p: any) => boolean;
export var asArray: <T>(...args: T[]) => T[];
export var not: (value: any) => boolean;
export var isFunction: (value: any) => boolean;
}
export type _Selector<T, TResult> = (value: T, index: number, observable: Observable<T>) => TResult;
export type _ValueOrSelector<T, TResult> = TResult | _Selector<T, TResult>;
export type _Predicate<T> = _Selector<T, boolean>;
export type _Comparer<T, TResult> = (value1: T, value2: T) => TResult;
export type _Accumulator<T, TAcc> = (acc: TAcc, value: T) => TAcc;
export module special {
export type _FlatMapResultSelector<T1, T2, TResult> = (value: T1, selectorValue: T2, index: number, selectorOther: number) => TResult;
}
export interface IObservable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface Observable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable;
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface ObservableStatic {
/**
* Determines whether the given object is an Observable
* @param {Any} An object to determine whether it is an Observable
* @returns {Boolean} true if an Observable, else false.
*/
isObservable(o: any): boolean;
}
export var Observable: ObservableStatic;
export interface Pattern2<T1, T2> {
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
and<T3>(other: Observable<T3>): Pattern3<T1, T2, T3>;
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
thenDo<TR>(selector: (item1: T1, item2: T2) => TR): Plan<TR>;
}
interface Pattern3<T1, T2, T3> {
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
and<T4>(other: Observable<T4>): Pattern4<T1, T2, T3, T4>;
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3) => TR): Plan<TR>;
}
interface Pattern4<T1, T2, T3, T4> {
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
and<T5>(other: Observable<T5>): Pattern5<T1, T2, T3, T4, T5>;
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4) => TR): Plan<TR>;
}
interface Pattern5<T1, T2, T3, T4, T5> {
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
and<T6>(other: Observable<T6>): Pattern6<T1, T2, T3, T4, T5, T6>;
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5) => TR): Plan<TR>;
}
interface Pattern6<T1, T2, T3, T4, T5, T6> {
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
and<T7>(other: Observable<T7>): Pattern7<T1, T2, T3, T4, T5, T6, T7>;
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6) => TR): Plan<TR>;
}
interface Pattern7<T1, T2, T3, T4, T5, T6, T7> {
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
and<T8>(other: Observable<T8>): Pattern8<T1, T2, T3, T4, T5, T6, T7, T8>;
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6, item7: T7) => TR): Plan<TR>;
}
interface Pattern8<T1, T2, T3, T4, T5, T6, T7, T8> {
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
and<T9>(other: Observable<T9>): Pattern9<T1, T2, T3, T4, T5, T6, T7, T8, T9>;
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6, item7: T7, item8: T8) => TR): Plan<TR>;
}
interface Pattern9<T1, T2, T3, T4, T5, T6, T7, T8, T9> {
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6, item7: T7, item8: T8, item9: T9) => TR): Plan<TR>;
}
export interface Observable<T> {
/**
* Creates a pattern that matches when both observable sequences have an available value.
*
* @param right Observable sequence to match with the current sequence.
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
*/
and<T2>(right: Observable<T2>): Pattern2<T, T2>;
}
export interface Observable<T> {
/**
* Matches when the observable sequence has an available value and projects the value.
*
* @param {Function} selector Selector that will be invoked for values in the source sequence.
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
thenDo<TR>(selector: (item1: T) => TR): Plan<TR>;
}
export interface ObservableStatic {
/**
* Joins together the results from several patterns.
*
* @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.
* @returns {Observable} Observable sequence with the results form matching several patterns.
*/
when<TR>(plan: Plan<TR>): Observable<TR>;
}
}
declare module "rx.joinpatterns" {
export = Rx;
}
declare module "rx" { export = Rx; }
declare module "rx.joinpatterns" { export = Rx; }

@@ -1,64 +0,546 @@

// Type definitions for RxJS-Testing v2.2.28
// Project: https://github.com/Reactive-Extensions/RxJS/
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
///<reference path="rx.d.ts" />
///<reference path="rx.virtualtime.d.ts" />
// Type alias for observables and promises
export type ObservableOrPromise<T> = IObservable<T> | Promise<T>;
declare module Rx {
export interface TestScheduler extends VirtualTimeScheduler<number, number> {
createColdObservable<T>(...records: Recorded[]): Observable<T>;
createHotObservable<T>(...records: Recorded[]): Observable<T>;
createObserver<T>(): MockObserver<T>;
export type ArrayLike<T> = Array<T> | { length: number;[index: number]: T; };
startWithTiming<T>(create: () => Observable<T>, createdAt: number, subscribedAt: number, disposedAt: number): MockObserver<T>;
startWithDispose<T>(create: () => Observable<T>, disposedAt: number): MockObserver<T>;
startWithCreate<T>(create: () => Observable<T>): MockObserver<T>;
}
// Type alias for arrays and array like objects
export type ArrayOrIterable<T> = ArrayLike<T>;
export var TestScheduler: {
new (): TestScheduler;
};
/**
* Promise A+
*/
export interface Promise<T> {
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected: (error: any) => Promise<R>): Promise<R>;
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected?: (error: any) => R): Promise<R>;
}
export class Recorded {
constructor(time: number, value: any, equalityComparer?: (x: any, y: any) => boolean);
equals(other: Recorded): boolean;
toString(): string;
time: number;
value: any;
}
/**
* Promise A+
*/
export type IPromise<T> = Promise<T>;
export var ReactiveTest: {
created: number;
subscribed: number;
disposed: number;
/**
* Represents a push-style collection.
*/
export interface IObservable<T> { }
onNext(ticks: number, value: any): Recorded;
onNext(ticks: number, predicate: (value: any) => boolean): Recorded;
onError(ticks: number, exception: any): Recorded;
onError(ticks: number, predicate: (exception: any) => boolean): Recorded;
onCompleted(ticks: number): Recorded;
/**
* Represents a push-style collection.
*/
export interface Observable<T> { }
subscribe(subscribeAt: number, unsubscribeAt?: number): Subscription;
};
export interface Subscription {
/**
* Checks whether the given subscription is equal to the current instance.
* @param other Subscription object to check for equality.
* @returns {Boolean} true if both objects are equal; false otherwise.
*/
equals(other: Subscription): boolean;
/**
* Returns a string representation of the current Subscription value.
* @returns {String} String representation of the current Subscription value.
*/
toString(): string;
}
export class Subscription {
constructor(subscribeAt: number, unsubscribeAt?: number);
equals(other: Subscription): boolean;
}
interface SubscriptionStatic {
/**
* Creates a new subscription object with the given virtual subscription and unsubscription time.
*
* @constructor
* @param {Number} subscribe Virtual time at which the subscription occurred.
* @param {Number} unsubscribe Virtual time at which the unsubscription occurred.
*/
new (subscribeAt: number, unsubscribeAt?: number);
}
export interface MockObserver<T> extends Observer<T> {
messages: Recorded[];
}
export var Subscription: SubscriptionStatic;
interface MockObserverStatic extends ObserverStatic {
new <T>(scheduler: IScheduler): MockObserver<T>;
}
export interface Recorded {
/**
* Checks whether the given recorded object is equal to the current instance.
*
* @param {Recorded} other Recorded object to check for equality.
* @returns {Boolean} true if both objects are equal; false otherwise.
*/
equals(other: Recorded): boolean;
/**
* Returns a string representation of the current Recorded value.
*
* @returns {String} String representation of the current Recorded value.
*/
toString(): string;
time: number;
value: any;
}
export var MockObserver: MockObserverStatic;
interface RecordedStatic {
/**
* Creates a new object recording the production of the specified value at the given virtual time.
*
* @constructor
* @param {Number} time Virtual time the value was produced on.
* @param {Mixed} value Value that was produced.
* @param {Function} comparer An optional comparer.
*/
new (time: number, value: any, equalityComparer?: _Comparer<any, boolean>): Recorded;
}
export var Recorded: RecordedStatic;
export var ReactiveTest: {
/** Default virtual time used for creation of observable sequences in unit tests. */
created: number;
/** Default virtual time used to subscribe to observable sequences in unit tests. */
subscribed: number;
/** Default virtual time used to dispose subscriptions in unit tests. */
disposed: number;
/**
* Factory method for an OnNext notification record at a given time with a given value or a predicate function.
*
* 1 - ReactiveTest.onNext(200, 42);
* 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; });
*
* @param ticks Recorded virtual time the OnNext notification occurs.
* @param value Recorded value stored in the OnNext notification or a predicate.
* @return Recorded OnNext notification.
*/
onNext(ticks: number, value: any): Recorded;
/**
* Factory method for an OnNext notification record at a given time with a given value or a predicate function.
*
* 1 - ReactiveTest.onNext(200, 42);
* 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; });
*
* @param ticks Recorded virtual time the OnNext notification occurs.
* @param value Recorded value stored in the OnNext notification or a predicate.
* @return Recorded OnNext notification.
*/
onNext(ticks: number, predicate: (value: any) => boolean): Recorded;
/**
* Factory method for an OnError notification record at a given time with a given error.
*
* 1 - ReactiveTest.onNext(200, new Error('error'));
* 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; });
*
* @param ticks Recorded virtual time the OnError notification occurs.
* @param exception Recorded exception stored in the OnError notification.
* @return Recorded OnError notification.
*/
onError(ticks: number, exception: any): Recorded;
/**
* Factory method for an OnError notification record at a given time with a given error.
*
* 1 - ReactiveTest.onNext(200, new Error('error'));
* 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; });
*
* @param ticks Recorded virtual time the OnError notification occurs.
* @param exception Recorded exception stored in the OnError notification.
* @return Recorded OnError notification.
*/
onError(ticks: number, predicate: (exception: any) => boolean): Recorded;
/**
* Factory method for an OnCompleted notification record at a given time.
*
* @param ticks Recorded virtual time the OnCompleted notification occurs.
* @return Recorded OnCompleted notification.
*/
onCompleted(ticks: number): Recorded;
/**
* Factory method for a subscription record based on a given subscription and disposal time.
*
* @param start Virtual time indicating when the subscription was created.
* @param end Virtual time indicating when the subscription was disposed.
* @return Subscription object.
*/
subscribe(subscribeAt: number, unsubscribeAt?: number): Subscription;
}
/**
* Supports push-style iteration over an observable sequence.
*/
export interface IObserver<T> {
/**
* Notifies the observer of a new element in the sequence.
* @param {Any} value Next element in the sequence.
*/
onNext(value: T): void;
/**
* Notifies the observer that an exception has occurred.
* @param {Any} error The error that has occurred.
*/
onError(exception: any): void;
/**
* Notifies the observer of the end of the sequence.
*/
onCompleted(): void;
}
export interface Observer<T> {
/**
* Notifies the observer of a new element in the sequence.
* @param {Any} value Next element in the sequence.
*/
onNext(value: T): void;
/**
* Notifies the observer that an exception has occurred.
* @param {Any} error The error that has occurred.
*/
onError(exception: any): void;
/**
* Notifies the observer of the end of the sequence.
*/
onCompleted(): void;
}
export interface ObserverStatic {
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
create<T>(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observer<T>;
}
/**
* Supports push-style iteration over an observable sequence.
*/
export var Observer: ObserverStatic;
export interface IScheduler {
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedule(action: () => void): IDisposable;
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithState<TState>(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelative(dueTime: number, action: () => void): IDisposable;
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelativeAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;
}
export interface SchedulerStatic {
new (
now: () => number,
schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Rx.IScheduler;
/** Gets the current time according to the local machine's system clock. */
now: number;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
normalize(timeSpan: number): number;
}
/** Provides a set of static properties to access commonly used schedulers. */
export var Scheduler: SchedulerStatic;
export interface MockObserver<T> extends Observer<T> {
messages: Recorded[];
}
interface MockObserverStatic extends ObserverStatic {
new <T>(scheduler: IScheduler): MockObserver<T>;
}
export var MockObserver: MockObserverStatic;
export interface VirtualTimeScheduler<TAbsolute, TRelative> extends IScheduler {
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
add(from: TAbsolute, by: TRelative): TAbsolute;
/**
* Converts an absolute time to a number
* @param {Any} The absolute time.
* @returns {Number} The absolute time in ms
*/
toDateTimeOffset(duetime: TAbsolute): number;
/**
* Converts the TimeSpan value to a relative virtual time value.
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
toRelative(duetime: number): TRelative;
/**
* Starts the virtual time scheduler.
*/
start(): IDisposable;
/**
* Stops the virtual time scheduler.
*/
stop(): void;
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
advanceTo(time: TAbsolute): void;
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
advanceBy(time: TRelative): void;
/**
* Advances the scheduler's clock by the specified relative time.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
sleep(time: TRelative): void;
isEnabled: boolean;
/**
* Gets the next scheduled item to be executed.
* @returns {ScheduledItem} The next scheduled item.
*/
getNext(): internals.ScheduledItem<TAbsolute>;
}
export module config {
export var Promise: { new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise<T>; };
}
export module helpers {
export var noop: () => void;
export var notDefined: (value: any) => boolean;
export var identity: <T>(value: T) => T;
export var defaultNow: () => number;
export var defaultComparer: (left: any, right: any) => boolean;
export var defaultSubComparer: (left: any, right: any) => number;
export var defaultKeySerializer: (key: any) => string;
export var defaultError: (err: any) => void;
export var isPromise: (p: any) => boolean;
export var asArray: <T>(...args: T[]) => T[];
export var not: (value: any) => boolean;
export var isFunction: (value: any) => boolean;
}
export type _Selector<T, TResult> = (value: T, index: number, observable: Observable<T>) => TResult;
export type _ValueOrSelector<T, TResult> = TResult | _Selector<T, TResult>;
export type _Predicate<T> = _Selector<T, boolean>;
export type _Comparer<T, TResult> = (value1: T, value2: T) => TResult;
export type _Accumulator<T, TAcc> = (acc: TAcc, value: T) => TAcc;
export module special {
export type _FlatMapResultSelector<T1, T2, TResult> = (value: T1, selectorValue: T2, index: number, selectorOther: number) => TResult;
}
export interface IObservable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface Observable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable;
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface ObservableStatic {
/**
* Determines whether the given object is an Observable
* @param {Any} An object to determine whether it is an Observable
* @returns {Boolean} true if an Observable, else false.
*/
isObservable(o: any): boolean;
}
export var Observable: ObservableStatic;
export interface TestScheduler extends VirtualTimeScheduler<number, number> {
/**
* Creates a cold observable using the specified timestamped notification messages either as an array or arguments.
* @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time.
* @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications.
*/
createColdObservable<T>(...records: Recorded[]): Observable<T>;
/**
* Creates a hot observable using the specified timestamped notification messages either as an array or arguments.
* @param messages Notifications to surface through the created sequence at their specified absolute virtual times.
* @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications.
*/
createHotObservable<T>(...records: Recorded[]): Observable<T>;
/**
* Creates an observer that records received notification messages and timestamps those.
* @return Observer that can be used to assert the timing of received notifications.
*/
createObserver<T>(): MockObserver<T>;
/**
* Creates a resolved promise with the given value and ticks
* @param {Number} ticks The absolute time of the resolution.
* @param {Any} value The value to yield at the given tick.
* @returns {MockPromise} A mock Promise which fulfills with the given value.
*/
createResolvedPromise<T>(ticks: number, value: T): IPromise<T>;
/**
* Creates a rejected promise with the given reason and ticks
* @param {Number} ticks The absolute time of the resolution.
* @param {Any} reason The reason for rejection to yield at the given tick.
* @returns {MockPromise} A mock Promise which rejects with the given reason.
*/
createRejectedPromise<T>(ticks: number, value: T): IPromise<T>;
/**
* Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription.
*
* @param create Factory method to create an observable sequence.
* @param created Virtual time at which to invoke the factory to create an observable sequence.
* @param subscribed Virtual time at which to subscribe to the created observable sequence.
* @param disposed Virtual time at which to dispose the subscription.
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
*/
startWithTiming<T>(create: () => Observable<T>, createdAt: number, subscribedAt: number, disposedAt: number): MockObserver<T>;
/**
* Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function.
* Default virtual times are used for factory invocation and sequence subscription.
*
* @param create Factory method to create an observable sequence.
* @param disposed Virtual time at which to dispose the subscription.
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
*/
startWithDispose<T>(create: () => Observable<T>, disposedAt: number): MockObserver<T>;
/**
* Starts the test scheduler and uses default virtual times to invoke the factory function, to subscribe to the resulting sequence, and to dispose the subscription.
*
* @param create Factory method to create an observable sequence.
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
*/
startWithCreate<T>(create: () => Observable<T>): MockObserver<T>;
}
export var TestScheduler: {
new (): TestScheduler;
}
}
declare module "rx.testing" {
export = Rx;
}
declare module "rx" { export = Rx; }
declare module "rx.testing" { export = Rx; }

@@ -1,66 +0,734 @@

// Type definitions for RxJS-Time v2.2.28
// Project: http://rx.codeplex.com/
// Definitions by: Carl de Billy <http://carl.debilly.net/>, Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
///<reference path="rx.d.ts" />
///<reference path="rx.time-lite.d.ts" />
// Type alias for observables and promises
export type ObservableOrPromise<T> = IObservable<T> | Promise<T>;
declare module Rx {
export interface Observable<T> {
delaySubscription(dueTime: number, scheduler?: IScheduler): Observable<T>;
delayWithSelector(delayDurationSelector: (item: T) => number): Observable<T>;
delayWithSelector(subscriptionDelay: number, delayDurationSelector: (item: T) => number): Observable<T>;
export type ArrayLike<T> = Array<T> | { length: number;[index: number]: T; };
timeoutWithSelector<TTimeout>(firstTimeout: Observable<TTimeout>, timeoutdurationSelector?: (item: T) => Observable<TTimeout>, other?: Observable<T>): Observable<T>;
// Type alias for arrays and array like objects
export type ArrayOrIterable<T> = ArrayLike<T>;
debounceWithSelector<TTimeout>(debounceDurationSelector: (item: T) => Observable<TTimeout>): Observable<T>;
/**
* @deprecated use #debounceWithSelector instead.
*/
throttleWithSelector<TTimeout>(debounceDurationSelector: (item: T) => Observable<TTimeout>): Observable<T>;
/**
* Promise A+
*/
export interface Promise<T> {
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected: (error: any) => Promise<R>): Promise<R>;
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected?: (error: any) => R): Promise<R>;
}
skipLastWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
takeLastWithTime(duration: number, timerScheduler?: IScheduler, loopScheduler?: IScheduler): Observable<T>;
/**
* Promise A+
*/
export type IPromise<T> = Promise<T>;
takeLastBufferWithTime(duration: number, scheduler?: IScheduler): Observable<T[]>;
takeWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
skipWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
/**
* Represents a push-style collection.
*/
export interface IObservable<T> { }
skipUntilWithTime(startTime: Date, scheduler?: IScheduler): Observable<T>;
skipUntilWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
takeUntilWithTime(endTime: Date, scheduler?: IScheduler): Observable<T>;
takeUntilWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
/**
* Represents a push-style collection.
*/
export interface Observable<T> { }
windowWithTime(timeSpan: number, timeShift: number, scheduler?: IScheduler): Observable<Observable<T>>;
windowWithTime(timeSpan: number, scheduler?: IScheduler): Observable<Observable<T>>;
windowWithTimeOrCount(timeSpan: number, count: number, scheduler?: IScheduler): Observable<Observable<T>>;
bufferWithTime(timeSpan: number, timeShift: number, scheduler?: IScheduler): Observable<T[]>;
bufferWithTime(timeSpan: number, scheduler?: IScheduler): Observable<T[]>;
bufferWithTimeOrCount(timeSpan: number, count: number, scheduler?: IScheduler): Observable<T[]>;
export module config {
export var Promise: { new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise<T>; };
}
export module helpers {
export var noop: () => void;
export var notDefined: (value: any) => boolean;
export var identity: <T>(value: T) => T;
export var defaultNow: () => number;
export var defaultComparer: (left: any, right: any) => boolean;
export var defaultSubComparer: (left: any, right: any) => number;
export var defaultKeySerializer: (key: any) => string;
export var defaultError: (err: any) => void;
export var isPromise: (p: any) => boolean;
export var asArray: <T>(...args: T[]) => T[];
export var not: (value: any) => boolean;
export var isFunction: (value: any) => boolean;
}
export type _Selector<T, TResult> = (value: T, index: number, observable: Observable<T>) => TResult;
export type _ValueOrSelector<T, TResult> = TResult | _Selector<T, TResult>;
export type _Predicate<T> = _Selector<T, boolean>;
export type _Comparer<T, TResult> = (value1: T, value2: T) => TResult;
export type _Accumulator<T, TAcc> = (acc: TAcc, value: T) => TAcc;
export module special {
export type _FlatMapResultSelector<T1, T2, TResult> = (value: T1, selectorValue: T2, index: number, selectorOther: number) => TResult;
}
export interface IObservable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface Observable<T> {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable;
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(observer: IObserver<T>): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface ObservableStatic {
/**
* Determines whether the given object is an Observable
* @param {Any} An object to determine whether it is an Observable
* @returns {Boolean} true if an Observable, else false.
*/
isObservable(o: any): boolean;
}
export var Observable: ObservableStatic;
export interface ObservableStatic {
/**
* Returns an observable sequence that produces a value after each period.
*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/
interval(period: number, scheduler?: IScheduler): Observable<number>;
}
export interface IScheduler {
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedule(action: () => void): IDisposable;
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithState<TState>(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelative(dueTime: number, action: () => void): IDisposable;
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelativeAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;
}
export interface SchedulerStatic {
new (
now: () => number,
schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Rx.IScheduler;
/** Gets the current time according to the local machine's system clock. */
now: number;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
normalize(timeSpan: number): number;
}
/** Provides a set of static properties to access commonly used schedulers. */
export var Scheduler: SchedulerStatic;
export interface ObservableStatic {
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
timer(dueTime: number, period: number, scheduler?: IScheduler): Observable<number>;
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
timer(dueTime: number, scheduler?: IScheduler): Observable<number>;
}
export interface Observable<T> {
/**
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
*
* @example
* 1 - res = Rx.Observable.delay(new Date());
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
*
* 3 - res = Rx.Observable.delay(5000);
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
delay(dueTime: Date, scheduler?: IScheduler): Observable<T>;
/**
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
*
* @example
* 1 - res = Rx.Observable.delay(new Date());
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
*
* 3 - res = Rx.Observable.delay(5000);
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
delay(dueTime: number, scheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Ignores values from an observable sequence which are followed by another value before dueTime.
* @param {Number} dueTime Duration of the debounce period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The debounced sequence.
*/
debounce(dueTime: number, scheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
* @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
windowWithTime(timeSpan: number, timeShift: number, scheduler?: IScheduler): Observable<Observable<T>>;
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
* @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
windowWithTime(timeSpan: number, scheduler?: IScheduler): Observable<Observable<T>>;
}
export interface Observable<T> {
/**
* Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
* @param {Number} timeSpan Maximum time length of a window.
* @param {Number} count Maximum element count of a window.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
windowWithTimeOrCount(timeSpan: number, count: number, scheduler?: IScheduler): Observable<Observable<T>>;
}
export interface Observable<T> {
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
* @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
bufferWithTime(timeSpan: number, timeShift: number, scheduler?: IScheduler): Observable<T[]>;
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
* @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
bufferWithTime(timeSpan: number, scheduler?: IScheduler): Observable<T[]>;
}
export interface Observable<T> {
/**
* Projects each element of an observable sequence into a buffer that is completed when either it's full or a given amount of time has elapsed.
* @param {Number} timeSpan Maximum time length of a buffer.
* @param {Number} count Maximum element count of a buffer.
* @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
bufferWithTimeOrCount(timeSpan: number, count: number, scheduler?: IScheduler): Observable<T[]>;
}
export interface TimeInterval<T> {
value: T;
interval: number;
}
interface ObservableStatic {
timer(dueTime: Date, period: number, scheduler?: IScheduler): Observable<number>;
timer(dueTime: Date, scheduler?: IScheduler): Observable<number>;
export interface Observable<T> {
/**
* Records the time interval between consecutive values in an observable sequence.
*
* @example
* 1 - res = source.timeInterval();
* 2 - res = source.timeInterval(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with time interval information on values.
*/
timeInterval(scheduler?: IScheduler): Observable<TimeInterval<T>>;
}
generateWithRelativeTime<TState, TResult>(
initialState: TState,
condition: (state: TState) => boolean,
iterate: (state: TState) => TState,
resultSelector: (state: TState) => TResult,
timeSelector: (state: TState) => number,
scheduler?: IScheduler): Observable<TResult>;
generateWithAbsoluteTime<TState, TResult>(
initialState: TState,
condition: (state: TState) => boolean,
iterate: (state: TState) => TState,
resultSelector: (state: TState) => TResult,
timeSelector: (state: TState) => Date,
scheduler?: IScheduler): Observable<TResult>;
}
export interface Timestamp<T> {
value: T;
timestamp: number;
}
export interface Observable<T> {
/**
* Records the timestamp for each value in an observable sequence.
*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.default);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the default scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/
timestamp(scheduler?: IScheduler): Observable<Timestamp<T>>;
}
export interface Observable<T> {
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
sample(intervalOrSampler: number, scheduler?: IScheduler): Observable<T>;
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
sample<TSample>(sampler: Observable<TSample>, scheduler?: IScheduler): Observable<T>;
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
throttleLatest(interval: number, scheduler?: IScheduler): Observable<T>;
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
throttleLatest<TSample>(sampler: Observable<TSample>, scheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
timeout(dueTime: Date, other?: Observable<T>, scheduler?: IScheduler): Observable<T>;
/**
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
timeout(dueTime: number, other?: Observable<T>, scheduler?: IScheduler): Observable<T>;
}
export interface ObservableStatic {
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithAbsoluteTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return new Date(); }
* });
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
generateWithAbsoluteTime<TState, TResult>(
initialState: TState,
condition: (state: TState) => boolean,
iterate: (state: TState) => TState,
resultSelector: (state: TState) => TResult,
timeSelector: (state: TState) => Date,
scheduler?: IScheduler): Observable<TResult>;
}
export interface ObservableStatic {
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithRelativeTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return 500; }
* );
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
generateWithRelativeTime<TState, TResult>(
initialState: TState,
condition: (state: TState) => boolean,
iterate: (state: TState) => TState,
resultSelector: (state: TState) => TResult,
timeSelector: (state: TState) => number,
scheduler?: IScheduler): Observable<TResult>;
}
export interface Observable<T> {
/**
* Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.delaySubscription(5000); // 5s
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.default); // 5 seconds
*
* @param {Number} dueTime Relative or absolute time shift of the subscription.
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
delaySubscription(dueTime: number, scheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
*
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @returns {Observable} Time-shifted sequence.
*/
delayWithSelector(delayDurationSelector: (item: T) => ObservableOrPromise<number>): Observable<T>;
/**
* Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
*
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @returns {Observable} Time-shifted sequence.
*/
delayWithSelector(subscriptionDelay: Observable<number>, delayDurationSelector: (item: T) => ObservableOrPromise<number>): Observable<T>;
}
export interface Observable<T> {
/**
* Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
* @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param {Function} timeoutDurationSelector Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
timeoutWithSelector<TTimeout>(firstTimeout: Observable<TTimeout>, timeoutdurationSelector?: (item: T) => Observable<TTimeout>, other?: Observable<T>): Observable<T>;
}
export interface Observable<T> {
/**
* Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
* @param {Function} durationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @returns {Observable} The debounced sequence.
*/
debounceWithSelector(debounceDurationSelector: (item: T) => ObservableOrPromise<number>): Observable<T>;
}
export interface Observable<T> {
/**
* Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
*
* 1 - res = source.skipLastWithTime(5000);
* 2 - res = source.skipLastWithTime(5000, scheduler);
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for skipping elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*/
skipLastWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*/
takeLastWithTime(duration: number, timerScheduler?: IScheduler, loopScheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*/
takeLastBufferWithTime(duration: number, scheduler?: IScheduler): Observable<T[]>;
}
export interface Observable<T> {
/**
* Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*/
takeWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
*
* @description
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.
* This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
* may not execute immediately, despite the zero due time.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
* @param {Number} duration Duration for skipping elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*/
skipWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.
*
* @examples
* 1 - res = source.skipUntilWithTime(new Date(), [scheduler]);
* 2 - res = source.skipUntilWithTime(5000, [scheduler]);
* @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
*/
skipUntilWithTime(startTime: Date, scheduler?: IScheduler): Observable<T>;
/**
* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.
*
* @examples
* 1 - res = source.skipUntilWithTime(new Date(), [scheduler]);
* 2 - res = source.skipUntilWithTime(5000, [scheduler]);
* @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
*/
skipUntilWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
* @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param {Scheduler} [scheduler] Scheduler to run the timer on.
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
*/
takeUntilWithTime(endTime: Date, scheduler?: IScheduler): Observable<T>;
/**
* Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
* @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param {Scheduler} [scheduler] Scheduler to run the timer on.
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
*/
takeUntilWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
}
export interface Observable<T> {
/**
* Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
* @param {Number} windowDuration time to wait before emitting another item after emitting the last item
* @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
* @returns {Observable} An Observable that performs the throttle operation.
*/
throttleFirst(windowDuration: number, scheduler?: IScheduler): Observable<T>;
}
}
declare module "rx.time" {
export = Rx;
}
declare module "rx" { export = Rx; }
declare module "rx.time" { export = Rx; }

@@ -1,41 +0,269 @@

// Type definitions for RxJS-VirtualTime v2.2.28
// Project: http://rx.codeplex.com/
// Definitions by: gsino <http://www.codeplex.com/site/users/view/gsino>, Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
///<reference path="rx.d.ts" />
// Type alias for observables and promises
export type ObservableOrPromise<T> = IObservable<T> | Promise<T>;
declare module Rx {
export interface VirtualTimeScheduler<TAbsolute, TRelative> extends Scheduler {
//protected constructor(initialClock: TAbsolute, comparer: (first: TAbsolute, second: TAbsolute) => number);
export type ArrayLike<T> = Array<T> | { length: number;[index: number]: T; };
advanceBy(time: TRelative): void;
advanceTo(time: TAbsolute): void;
scheduleAbsolute(dueTime: TAbsolute, action: () => void): IDisposable;
scheduleAbsoluteWithState<TState>(state: TState, dueTime: TAbsolute, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
scheduleRelative(dueTime: TRelative, action: () => void): IDisposable;
scheduleRelativeWithState<TState>(state: TState, dueTime: TRelative, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
sleep(time: TRelative): void;
start(): IDisposable;
stop(): void;
// Type alias for arrays and array like objects
export type ArrayOrIterable<T> = ArrayLike<T>;
isEnabled: boolean;
/**
* Promise A+
*/
export interface Promise<T> {
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected: (error: any) => Promise<R>): Promise<R>;
then<R>(onFulfilled: (value: T) => R|Promise<R>, onRejected?: (error: any) => R): Promise<R>;
}
/* protected abstract */ add(from: TAbsolute, by: TRelative): TAbsolute;
/* protected abstract */ toDateTimeOffset(duetime: TAbsolute): number;
/* protected abstract */ toRelative(duetime: number): TRelative;
/**
* Promise A+
*/
export type IPromise<T> = Promise<T>;
/* protected */ getNext(): internals.ScheduledItem<TAbsolute>;
}
/**
* Represents a push-style collection.
*/
export interface IObservable<T> { }
export interface HistoricalScheduler extends VirtualTimeScheduler<number, number> {
}
/**
* Represents a push-style collection.
*/
export interface Observable<T> { }
export var HistoricalScheduler: {
new (initialClock: number, comparer: (first: number, second: number) => number): HistoricalScheduler;
};
export module internals {
export interface ScheduledItem<TTime> {
scheduler: IScheduler;
state: TTime;
action: (scheduler: IScheduler, state: any) => IDisposable;
dueTime: TTime;
comparer: (x: TTime, y: TTime) => number;
disposable: SingleAssignmentDisposable;
invoke(): void;
compareTo(other: ScheduledItem<TTime>): number;
isCancelled(): boolean;
invokeCore(): IDisposable;
}
interface ScheduledItemStatic {
new <TTime>(scheduler: IScheduler, state: any, action: (scheduler: IScheduler, state: any) => IDisposable, dueTime: TTime, comparer?: _Comparer<TTime, number>):ScheduledItem<TTime>;
}
export var ScheduledItem: ScheduledItemStatic
}
export module internals {
// Priority Queue for Scheduling
export interface PriorityQueue<TTime> {
length: number;
isHigherPriority(left: number, right: number): boolean;
percolate(index: number): void;
heapify(index: number): void;
peek(): ScheduledItem<TTime>;
removeAt(index: number): void;
dequeue(): ScheduledItem<TTime>;
enqueue(item: ScheduledItem<TTime>): void;
remove(item: ScheduledItem<TTime>): boolean;
}
interface PriorityQueueStatic {
new <T>(capacity: number) : PriorityQueue<T>;
count: number;
}
export var PriorityQueue : PriorityQueueStatic;
}
export interface IDisposable {
dispose(): void;
}
export interface Disposable extends IDisposable {
/** Is this value disposed. */
isDisposed?: boolean;
}
interface DisposableStatic {
/**
* Provides a set of static methods for creating Disposables.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
new (action: () => void): Disposable;
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
create(action: () => void): Disposable;
/**
* Gets the disposable that does nothing when disposed.
*/
empty: IDisposable;
/**
* Validates whether the given object is a disposable
* @param {Object} Object to test whether it has a dispose method
* @returns {Boolean} true if a disposable object, else false.
*/
isDisposable(d: any): boolean;
}
/**
* Provides a set of static methods for creating Disposables.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
export var Disposable: DisposableStatic;
export interface IScheduler {
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedule(action: () => void): IDisposable;
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithState<TState>(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelative(dueTime: number, action: () => void): IDisposable;
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleWithRelativeAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleRecursiveWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;
}
export interface SchedulerStatic {
new (
now: () => number,
schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Rx.IScheduler;
/** Gets the current time according to the local machine's system clock. */
now: number;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
normalize(timeSpan: number): number;
}
/** Provides a set of static properties to access commonly used schedulers. */
export var Scheduler: SchedulerStatic;
export interface VirtualTimeScheduler<TAbsolute, TRelative> extends IScheduler {
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
add(from: TAbsolute, by: TRelative): TAbsolute;
/**
* Converts an absolute time to a number
* @param {Any} The absolute time.
* @returns {Number} The absolute time in ms
*/
toDateTimeOffset(duetime: TAbsolute): number;
/**
* Converts the TimeSpan value to a relative virtual time value.
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
toRelative(duetime: number): TRelative;
/**
* Starts the virtual time scheduler.
*/
start(): IDisposable;
/**
* Stops the virtual time scheduler.
*/
stop(): void;
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
advanceTo(time: TAbsolute): void;
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
advanceBy(time: TRelative): void;
/**
* Advances the scheduler's clock by the specified relative time.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
sleep(time: TRelative): void;
isEnabled: boolean;
/**
* Gets the next scheduled item to be executed.
* @returns {ScheduledItem} The next scheduled item.
*/
getNext(): internals.ScheduledItem<TAbsolute>;
}
export interface HistoricalScheduler extends VirtualTimeScheduler<number, number> {
}
export var HistoricalScheduler: {
/**
* Creates a new historical scheduler with the specified initial clock value.
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
new (initialClock: number, comparer: _Comparer<number, number>): HistoricalScheduler;
};
}
declare module "rx.virtualtime" {
export = Rx;
}
declare module "rx" { export = Rx; }
declare module "rx.virtualtime" { export = Rx; }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc