webappengine
Version:
A web application platform that can host multiple web apps running with Node.js.
3 lines • 11.1 kB
JavaScript
/* 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"],function(b,c){return a(h,c,b)}):"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 o.apply(this,arguments)}catch(a){return I.e=a,I}}function f(a){if(!F(a))throw new TypeError("fn must be a function");return o=a,e}function g(a,b){return new r(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function h(a,b,c){return new r(function(d){var e=a,f=C(b);return c.scheduleRecursiveWithAbsoluteAndState(0,e,function(a,b){if(f>0){var g=c.now();e+=f,g>=e&&(e=g+f)}d.onNext(a),b(a+1,e)})})}function i(a,b){return new r(function(c){return b.scheduleWithRelative(C(a),function(){c.onNext(0),c.onCompleted()})})}function j(a,b,c){return a===b?new r(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):s(function(){return h(c.now()+a,b,c)})}function k(a,b,c){return new r(function(d){var e,f=!1,g=new x,h=null,i=[],j=!1;return e=a.materialize().timestamp(c).subscribe(function(a){var e,k;"E"===a.value.kind?(i=[],i.push(a),h=a.value.exception,k=!j):(i.push({value:a.value,timestamp:a.timestamp+b}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new w,g.setDisposable(e),e.setDisposable(c.scheduleRecursiveWithRelative(b,function(a){var b,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-c.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-c.now())):f=!1,b=h,j=!1,null!==b?d.onError(b):k&&a(e)}}))))}),new y(e,g)},a)}function l(a,b,c){return s(function(){return k(a,b-c.now(),c)})}function m(a){return a.toArray()}function m(a){return a.toArray()}function n(a,b){return new r(function(c){function d(){g&&(g=!1,c.onNext(e)),f&&c.onCompleted()}var e,f=!1,g=!1,h=new w;return h.setDisposable(a.subscribe(function(a){g=!0,e=a},function(a){c.onError(a)},function(){f=!0,h.dispose()})),new y(h,b.subscribe(d,function(a){c.onError(a)},d))},a)}var o,p=c.Observable,q=p.prototype,r=c.AnonymousObservable,s=p.defer,t=(p.empty,p.never),u=p["throw"],v=(p.fromArray,c.Scheduler["default"]),w=c.SingleAssignmentDisposable,x=c.SerialDisposable,y=c.CompositeDisposable,z=c.RefCountDisposable,A=c.Subject,B=c.internals.addRef,C=c.Scheduler.normalize,D=c.helpers,E=D.isPromise,F=D.isFunction,G=c.Scheduler.isScheduler,H=p.fromPromise,I={e:{}},J=p.interval=function(a,b){return j(a,a,G(b)?b:v)};p.timer=function(a,b,c){var e;return G(c)||(c=v),null!=b&&"number"==typeof b?e=b:G(b)&&(c=b),a instanceof Date&&e===d?g(a.getTime(),c):a instanceof Date&&e!==d?h(a.getTime(),b,c):e===d?i(a,c):j(a,e,c)};return q.delay=function(a,b){return G(b)||(b=v),a instanceof Date?l(this,a.getTime(),b):k(this,a,b)},q.debounce=function(a,b){G(b)||(b=v);var c=this;return new r(function(d){var e,f=new x,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new w;f.setDisposable(j),j.setDisposable(b.scheduleWithRelative(a,function(){g&&h===i&&d.onNext(e),g=!1}))},function(a){f.dispose(),d.onError(a),g=!1,h++},function(){f.dispose(),g&&d.onNext(e),d.onCompleted(),g=!1,h++});return new y(i,f)},this)},q.throttle=function(a,b){return this.debounce(a,b)},q.windowWithTime=function(a,b,c){var d,e=this;return null==b&&(d=a),G(c)||(c=v),"number"==typeof b?d=b:G(b)&&(d=a,c=b),new r(function(b){function f(){var a=new w,e=!1,g=!1;l.setDisposable(a),j===i?(e=!0,g=!0):i>j?e=!0:g=!0;var n=e?j:i,o=n-m;m=n,e&&(j+=d),g&&(i+=d),a.setDisposable(c.scheduleWithRelative(o,function(){if(g){var a=new A;k.push(a),b.onNext(B(a,h))}e&&k.shift().onCompleted(),f()}))}var g,h,i=d,j=a,k=[],l=new x,m=0;return g=new y(l),h=new z(g),k.push(new A),b.onNext(B(k[0],h)),f(),g.add(e.subscribe(function(a){for(var b=0,c=k.length;c>b;b++)k[b].onNext(a)},function(a){for(var c=0,d=k.length;d>c;c++)k[c].onError(a);b.onError(a)},function(){for(var a=0,c=k.length;c>a;a++)k[a].onCompleted();b.onCompleted()})),h},e)},q.windowWithTimeOrCount=function(a,b,c){var d=this;return G(c)||(c=v),new r(function(e){function f(b){var d=new w;g.setDisposable(d),d.setDisposable(c.scheduleWithRelative(a,function(){if(b===k){j=0;var a=++k;l.onCompleted(),l=new A,e.onNext(B(l,i)),f(a)}}))}var g=new x,h=new y(g),i=new z(h),j=0,k=0,l=new A;return e.onNext(B(l,i)),f(0),h.add(d.subscribe(function(a){var c=0,d=!1;l.onNext(a),++j===b&&(d=!0,j=0,c=++k,l.onCompleted(),l=new A,e.onNext(B(l,i))),d&&f(c)},function(a){l.onError(a),e.onError(a)},function(){l.onCompleted(),e.onCompleted()})),i},d)},q.bufferWithTime=function(a,b,c){return this.windowWithTime(a,b,c).flatMap(m)},q.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).flatMap(m)},q.timeInterval=function(a){var b=this;return G(a)||(a=v),s(function(){var c=a.now();return b.map(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},q.timestamp=function(a){return G(a)||(a=v),this.map(function(b){return{value:b,timestamp:a.now()}})},q.sample=q.throttleLatest=function(a,b){return G(b)||(b=v),"number"==typeof a?n(this,J(a,b)):n(this,a)},q.timeout=function(a,b,c){(null==b||"string"==typeof b)&&(b=u(new Error(b||"Timeout"))),G(c)||(c=v);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new r(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(E(b)&&(b=H(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new w,j=new x,k=!1,l=new x;return j.setDisposable(i),g(),i.setDisposable(d.subscribe(function(a){k||(h++,f.onNext(a),g())},function(a){k||(h++,f.onError(a))},function(){k||(h++,f.onCompleted())})),new y(j,l)},d)},p.generateWithAbsoluteTime=function(a,b,c,d,e,f){return G(f)||(f=v),new r(function(g){var h=!0,i=!1;return f.scheduleRecursiveWithAbsoluteAndState(a,f.now(),function(a,f){i&&g.onNext(a);try{if(h?h=!1:a=c(a),i=b(a))var j=d(a),k=e(a)}catch(l){return void g.onError(l)}i?f(j,k):g.onCompleted()})})},p.generateWithRelativeTime=function(a,b,c,d,e,f){return G(f)||(f=v),new r(function(g){var h=!0,i=!1;return f.scheduleRecursiveWithRelativeAndState(a,0,function(a,f){i&&g.onNext(a);try{if(h?h=!1:a=c(a),i=b(a))var j=d(a),k=e(a)}catch(l){return void g.onError(l)}i?f(j,k):g.onCompleted()})})},q.delaySubscription=function(a,b){var c=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative",d=this;return G(b)||(b=v),new r(function(e){var f=new x;return f.setDisposable(b[c](a,function(){f.setDisposable(d.subscribe(e))})),f},this)},q.delayWithSelector=function(a,b){var c,d,e=this;return F(a)?d=a:(c=a,d=b),new r(function(a){function b(){j.setDisposable(e.subscribe(function(b){var c=f(d)(b);if(c===I)return a.onError(c.e);var e=new w;h.add(e),e.setDisposable(c.subscribe(function(){a.onNext(b),h.remove(e),g()},function(b){a.onError(b)},function(){a.onNext(b),h.remove(e),g()}))},function(b){a.onError(b)},function(){i=!0,j.dispose(),g()}))}function g(){i&&0===h.length&&a.onCompleted()}var h=new y,i=!1,j=new x;return c?j.setDisposable(c.subscribe(b,function(b){a.onError(b)},b)):b(),new y(j,h)},this)},q.timeoutWithSelector=function(a,b,c){1===arguments.length&&(b=a,a=t()),c||(c=u(new Error("Timeout")));var d=this;return new r(function(e){function f(a){function b(){return k===d}var d=k,f=new w;i.setDisposable(f),f.setDisposable(a.subscribe(function(){b()&&h.setDisposable(c.subscribe(e)),f.dispose()},function(a){b()&&e.onError(a)},function(){b()&&h.setDisposable(c.subscribe(e))}))}function g(){var a=!l;return a&&k++,a}var h=new x,i=new x,j=new w;h.setDisposable(j);var k=0,l=!1;return f(a),j.setDisposable(d.subscribe(function(a){if(g()){e.onNext(a);var c;try{c=b(a)}catch(d){return void e.onError(d)}f(E(c)?H(c):c)}},function(a){g()&&e.onError(a)},function(){g()&&e.onCompleted()})),new y(h,i)},d)},q.debounceWithSelector=function(a){var b=this;return new r(function(c){var d,e=!1,g=new x,h=0,i=b.subscribe(function(b){var i=f(a)(b);if(i===I)return c.onError(i.e);E(i)&&(i=H(i)),e=!0,d=b,h++;var j=h,k=new w;g.setDisposable(k),k.setDisposable(i.subscribe(function(){e&&h===j&&c.onNext(d),e=!1,k.dispose()},function(a){c.onError(a)},function(){e&&h===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){g.dispose(),c.onError(a),e=!1,h++},function(){g.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,h++});return new y(i,g)},b)},q.skipLastWithTime=function(a,b){G(b)||(b=v);var c=this;return new r(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},function(a){d.onError(a)},function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})},c)},q.takeLastWithTime=function(a,b){var c=this;return G(b)||(b=v),new r(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},function(a){d.onError(a)},function(){for(var c=b.now();e.length>0;){var f=e.shift();c-f.interval<=a&&d.onNext(f.value)}d.onCompleted()})},c)},q.takeLastBufferWithTime=function(a,b){var c=this;return G(b)||(b=v),new r(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},function(a){d.onError(a)},function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})},c)},q.takeWithTime=function(a,b){var c=this;return G(b)||(b=v),new r(function(d){return new y(b.scheduleWithRelative(a,function(){d.onCompleted()}),c.subscribe(d))},c)},q.skipWithTime=function(a,b){var c=this;return G(b)||(b=v),new r(function(d){var e=!1;return new y(b.scheduleWithRelative(a,function(){e=!0}),c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d)))},c)},q.skipUntilWithTime=function(a,b){G(b)||(b=v);var c=this,d=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new r(function(e){var f=!1;return new y(b[d](a,function(){f=!0}),c.subscribe(function(a){f&&e.onNext(a)},function(a){e.onError(a)},function(){e.onCompleted()}))},c)},q.takeUntilWithTime=function(a,b){G(b)||(b=v);var c=this,d=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new r(function(e){return new y(b[d](a,function(){e.onCompleted()}),c.subscribe(e))},c)},q.throttleFirst=function(a,b){G(b)||(b=v);var c=+a||0;if(0>=c)throw new RangeError("windowDuration cannot be less or equal zero.");var d=this;return new r(function(a){var e=0;return d.subscribe(function(d){var f=b.now();(0===e||f-e>=c)&&(e=f,a.onNext(d))},function(b){a.onError(b)},function(){a.onCompleted()})},d)},c});
//# sourceMappingURL=rx.time.map