3 lines
6.4 KiB
JavaScript
3 lines
6.4 KiB
JavaScript
|
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
|
||
|
(function(a){function b(a){return a&&a.Object===Object?a:null}var c={"function":!0,object:!0},d=c[typeof exports]&&exports&&!exports.nodeType?exports:null,e=c[typeof module]&&module&&!module.nodeType?module:null,f=b(d&&e&&"object"==typeof global&&global),g=b(c[typeof self]&&self),h=b(c[typeof window]&&window),i=(e&&e.exports===d?d:null,b(c[typeof this]&&this)),j=f||h!==(i&&i.window)&&h||g||i||Function("return this")();"function"==typeof define&&define.amd?define(["./rx.virtualtime","exports"],function(b,c){return j.Rx=a(j,c,b),j.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(j,module.exports,require("./rx")):j.Rx=a(j,{},j.Rx)}).call(this,function(a,b,c,d){function e(a){this.predicate=a}function f(a){this.predicate=a}function g(a,b){var c=this;this.scheduler=a,this.messages=b,this.subscriptions=[],this.observers=[];for(var d=0,e=this.messages.length;e>d;d++){var f=this.messages[d],g=f.value;!function(b){a.scheduleAbsolute(null,f.time,function(){for(var a=c.observers.slice(0),d=0,e=a.length;e>d;d++)b.accept(a[d]);return m})}(g)}}var h=c.Observer,i=c.Observable,j=c.Notification,k=c.VirtualTimeScheduler,l=c.Disposable,m=l.empty,n=l.create,o=c.CompositeDisposable,p=c.internals.inherits,q=c.internals.isEqual;e.prototype.equals=function(a){return a===this?!0:null==a?!1:"N"!==a.kind?!1:this.predicate(a.value)},f.prototype.equals=function(a){return a===this?!0:null==a?!1:"E"!==a.kind?!1:this.predicate(a.error)};var r=c.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(a,b){return"function"==typeof b?new s(a,new e(b)):new s(a,j.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new s(a,new f(b)):new s(a,j.createOnError(b))},onCompleted:function(a){return new s(a,j.createOnCompleted())},subscribe:function(a,b){return new t(a,b)}},s=c.Recorded=function(a,b,c){this.time=a,this.value=b,this.comparer=c||q};s.prototype.equals=function(a){return this.time===a.time&&this.comparer(this.value,a.value)},s.prototype.toString=function(){return this.value.toString()+"@"+this.time};var t=c.Subscription=function(a,b){this.subscribe=a,this.unsubscribe=b||Number.MAX_VALUE};t.prototype.equals=function(a){return this.subscribe===a.subscribe&&this.unsubscribe===a.unsubscribe},t.prototype.toString=function(){return"("+this.subscribe+", "+(this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe)+")"};var u=c.MockDisposable=function(a){this.scheduler=a,this.disposes=[],this.disposes.push(this.scheduler.clock)};u.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var v=function(a){function b(b){a.call(this),this.scheduler=b,this.messages=[]}p(b,a);var c=b.prototype;return c.onNext=function(a){this.messages.push(new s(this.scheduler.clock,j.createOnNext(a)))},c.onError=function(a){this.messages.push(new s(this.scheduler.clock,j.createOnError(a)))},c.onCompleted=function(){this.messages.push(new s(this.scheduler.clock,j.createOnCompleted()))},b}(h);g.prototype.then=function(a,b){var e=this;this.subscriptions.push(new t(this.scheduler.clock));var f,h=this.subscriptions.length-1,i=c.Observer.create(function(b){var j=a(b);if(j&&"function"==typeof j.then)f=j;else{var k=e.scheduler.clock;f=new g(e.scheduler,[c.ReactiveTest.onNext(k,d),c.ReactiveTest.onCompleted(k)])}var l=e.observers.indexOf(i);e.observers.splice(l,1),e.subscriptions[h]=new t(e.subscriptions[h].subscribe,e.scheduler.clock)},function(a){b(a);var c=e.observers.indexOf(i);e.observers.splice(c,1),e.subscriptions[h]=new t(e.subscriptions[h].subscribe,e.scheduler.clock)});return this.observers.push(i),f||new g(this.scheduler,this.messages)};var w=function(a){function b(b,c){a.call(this);var d,e,f=this;this.scheduler=b,this.messages=c,this.subscriptions=[],this.observers=[];for(var g=0,h=this.messages.length;h>g;g++)d=this.messages[g],e=d.value,function(a){b.scheduleAbsolute(null,d.time,function(){for(var b=f.observers.slice(0),c=0,d=b.length;d>c;c++)a.accept(b[c]);return m})}(e)}return p(b,a),b.prototype._subscribe=function(a){var b=this;this.observers.push(a),this.subscriptions.push(new t(this.scheduler.clock)
|
||
|
//# sourceMappingURL=rx.testing.map
|