rxjs-rails 2.5.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rxjs/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/rx.aggregates.js +367 -284
  4. data/vendor/assets/javascripts/rx.aggregates.map +1 -1
  5. data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
  6. data/vendor/assets/javascripts/rx.all.compat.js +2405 -2438
  7. data/vendor/assets/javascripts/rx.all.compat.map +1 -1
  8. data/vendor/assets/javascripts/rx.all.compat.min.js +4 -4
  9. data/vendor/assets/javascripts/rx.all.js +2380 -2395
  10. data/vendor/assets/javascripts/rx.all.map +1 -1
  11. data/vendor/assets/javascripts/rx.all.min.js +4 -4
  12. data/vendor/assets/javascripts/rx.async.compat.js +311 -333
  13. data/vendor/assets/javascripts/rx.async.compat.map +1 -1
  14. data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
  15. data/vendor/assets/javascripts/rx.async.js +280 -327
  16. data/vendor/assets/javascripts/rx.async.map +1 -1
  17. data/vendor/assets/javascripts/rx.async.min.js +1 -1
  18. data/vendor/assets/javascripts/rx.backpressure.js +208 -176
  19. data/vendor/assets/javascripts/rx.backpressure.map +1 -1
  20. data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
  21. data/vendor/assets/javascripts/rx.binding.js +44 -27
  22. data/vendor/assets/javascripts/rx.binding.map +1 -1
  23. data/vendor/assets/javascripts/rx.binding.min.js +1 -1
  24. data/vendor/assets/javascripts/rx.coincidence.js +220 -453
  25. data/vendor/assets/javascripts/rx.coincidence.map +1 -1
  26. data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
  27. data/vendor/assets/javascripts/rx.compat.js +1366 -1173
  28. data/vendor/assets/javascripts/rx.compat.map +1 -1
  29. data/vendor/assets/javascripts/rx.compat.min.js +3 -2
  30. data/vendor/assets/javascripts/rx.core.binding.js +823 -0
  31. data/vendor/assets/javascripts/rx.core.binding.map +1 -0
  32. data/vendor/assets/javascripts/rx.core.binding.min.js +3 -0
  33. data/vendor/assets/javascripts/rx.core.js +1281 -0
  34. data/vendor/assets/javascripts/rx.core.map +1 -0
  35. data/vendor/assets/javascripts/rx.core.min.js +3 -0
  36. data/vendor/assets/javascripts/rx.core.testing.js +1242 -0
  37. data/vendor/assets/javascripts/rx.core.testing.map +1 -0
  38. data/vendor/assets/javascripts/rx.core.testing.min.js +3 -0
  39. data/vendor/assets/javascripts/rx.experimental.js +85 -123
  40. data/vendor/assets/javascripts/rx.experimental.map +1 -1
  41. data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
  42. data/vendor/assets/javascripts/rx.joinpatterns.js +48 -37
  43. data/vendor/assets/javascripts/rx.joinpatterns.map +1 -1
  44. data/vendor/assets/javascripts/rx.joinpatterns.min.js +1 -1
  45. data/vendor/assets/javascripts/rx.js +1367 -1174
  46. data/vendor/assets/javascripts/rx.lite.compat.js +1621 -1403
  47. data/vendor/assets/javascripts/rx.lite.compat.map +1 -1
  48. data/vendor/assets/javascripts/rx.lite.compat.min.js +3 -3
  49. data/vendor/assets/javascripts/rx.lite.extras.compat.js +119 -89
  50. data/vendor/assets/javascripts/rx.lite.extras.compat.map +1 -1
  51. data/vendor/assets/javascripts/rx.lite.extras.compat.min.js +1 -1
  52. data/vendor/assets/javascripts/rx.lite.extras.js +119 -89
  53. data/vendor/assets/javascripts/rx.lite.extras.map +1 -1
  54. data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
  55. data/vendor/assets/javascripts/rx.lite.js +1583 -1390
  56. data/vendor/assets/javascripts/rx.lite.map +1 -1
  57. data/vendor/assets/javascripts/rx.lite.min.js +3 -3
  58. data/vendor/assets/javascripts/rx.map +1 -1
  59. data/vendor/assets/javascripts/rx.min.js +3 -2
  60. data/vendor/assets/javascripts/rx.sorting.js +23 -27
  61. data/vendor/assets/javascripts/rx.sorting.map +1 -1
  62. data/vendor/assets/javascripts/rx.sorting.min.js +1 -1
  63. data/vendor/assets/javascripts/rx.testing.js +11 -15
  64. data/vendor/assets/javascripts/rx.testing.map +1 -1
  65. data/vendor/assets/javascripts/rx.testing.min.js +1 -1
  66. data/vendor/assets/javascripts/rx.time.js +117 -133
  67. data/vendor/assets/javascripts/rx.time.map +1 -1
  68. data/vendor/assets/javascripts/rx.time.min.js +1 -1
  69. data/vendor/assets/javascripts/rx.virtualtime.js +120 -39
  70. data/vendor/assets/javascripts/rx.virtualtime.map +1 -1
  71. data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
  72. metadata +12 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rx.core.min.js","sources":["rx.core.js"],"names":["tryCatcher","tryCatchTarget","apply","this","arguments","e","errorObj","tryCatch","fn","isFunction","TypeError","thrower","makeStackTraceLong","error","observable","hasStacks","stack","indexOf","STACK_JUMP_SEPARATOR","stacks","o","source","unshift","concatedStacks","join","filterStackString","stackString","lines","split","desiredLines","i","len","length","line","isInternalFrame","isNodeFrame","push","stackLine","fileNameAndLineNumber","getFileNameAndLineNumber","fileName","lineNumber","rFileName","rStartingLine","rEndingLine","captureLine","Error","firstLine","attempt1","exec","Number","attempt2","attempt3","objectTypes","function","object","freeExports","exports","nodeType","freeSelf","self","Object","freeWindow","window","freeModule","module","moduleExports","freeGlobal","global","root","Rx","internals","config","Promise","helpers","noop","defaultNow","Date","now","defaultError","err","defaultSubComparer","isPromise","p","subscribe","then","x","y","isFn","value","toString","call","NotImplementedError","message","prototype","NotSupportedError","notImplemented","notSupported","longStackSupport","inherits","hasOwnProperty","Array","slice","child","parent","__","constructor","CompositeDisposable","addProperties","obj","sources","idx","ln","prop","addRef","xs","r","AnonymousObservable","observer","getDisposable","args","isArray","isDisposable","disposables","isDisposed","CompositeDisposablePrototype","add","item","dispose","remove","shouldDispose","splice","currentDisposables","Disposable","action","disposableCreate","create","disposableEmpty","empty","d","SingleAssignmentDisposable","checkDisposed","disposable","ObjectDisposedError","current","setDisposable","old","SerialDisposable","ScheduledItem","scheduler","state","dueTime","comparer","invoke","invokeCore","compareTo","other","isCancelled","Scheduler","schedule","scheduleRelative","scheduleAbsolute","_schedule","_scheduleRelative","_scheduleAbsolute","invokeAction","isScheduler","s","schedulerProto","scheduleWithState","scheduleWithRelative","scheduleWithRelativeAndState","scheduleWithAbsolute","scheduleWithAbsoluteAndState","normalize","timeSpan","normalizeTime","invokeRecImmediate","pair","innerAction","state2","scheduleWork","_","state3","isAdded","group","isDone","invokeRecDate","method","dueTime1","invokeRecDateRelative","invokeRecDateAbsolute","scheduleInnerRecursive","dt","scheduleRecursive","scheduleRecursiveWithState","scheduleRecursiveWithRelative","scheduleRecursiveWithRelativeAndState","scheduleRecursiveWithAbsolute","scheduleRecursiveWithAbsoluteAndState","schedulePeriodic","period","schedulePeriodicWithState","setInterval","id","clearInterval","scheduleMethod","clearMethod","currentThreadScheduler","SchedulePeriodicRecursive","tick","command","recurse","_period","_state","_action","_cancel","_scheduler","start","bind","immediate","scheduleNow","currentThread","runTrampoline","queue","shift","si","result","currentScheduler","scheduleRequired","localTimer","localSetTimeout","localClearTimeout","setTimeout","clearTimeout","WScript","time","Sleep","runTask","handle","currentlyRunning","task","tasksByHandle","postMessageSupported","postMessage","importScripts","isAsync","oldHandler","onmessage","onGlobalPostMessage","event","data","substring","MSG_PREFIX","nextHandle","reNative","RegExp","String","replace","setImmediate","test","process","nextTick","Math","random","addEventListener","attachEvent","currentId","MessageChannel","channel","port1","port2","document","createElement","scriptElement","onreadystatechange","parentNode","removeChild","documentElement","appendChild","observableProto","Observer","timeout","observerCreate","onNext","onError","onCompleted","AnonymousObserver","AbstractObserver","__super__","isStopped","next","completed","fail","_onNext","_onError","_onCompleted","Observable","makeSubscribe","oldOnError","_subscribe","isObservable","forEach","oOrOnNext","subscribeOnNext","thisArg","subscribeOnError","subscribeOnCompleted","fixSubscriber","subscriber","ado","sub","__subscribe","innerSubscribe","AutoDetachObserver","ObservableBase","subscribeCore","m","AutoDetachObserverPrototype","define","amd"],"mappings":";CAEE,WAoEA,QA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,EAAWP,QAAUa,GAAIA,GAAKA,EAE/Bd,EAAYc,GAAKA,EAInBD,EAAKC,GAAKA,CAIZ,IAAI1B,IAAcC,MAElB8C,KAAKxF"}
@@ -0,0 +1,3 @@
1
+ /* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
2
+ (function(){function a(){try{return y.apply(this,arguments)}catch(a){return B.e=a,B}}function b(b){if(!isFunction(b))throw new TypeError("fn must be a function");return y=b,a}function c(a){throw a}function d(a,b){if(C&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(G)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var f=c.join("\n"+G+"\n");a.stack=e(f)}}function e(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var h=b[d];f(h)||g(h)||!h||c.push(h)}return c.join("\n")}function f(a){var b=i(a);if(!b)return!1;var c=b[0],d=b[1];return c===E&&d>=F&&fb>=d}function g(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function h(){if(C)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=i(c);if(!d)return;return E=d[0],d[1]}}function i(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 j={"function":!0,object:!0},k=j[typeof exports]&&exports&&!exports.nodeType&&exports,l=j[typeof self]&&self.Object&&self,m=j[typeof window]&&window&&window.Object&&window,n=j[typeof module]&&module&&!module.nodeType&&module,o=n&&n.exports===k&&k,p=k&&n&&"object"==typeof global&&global&&global.Object&&global,q=q=p||m!==(this&&this.window)&&m||l||this,r={internals:{},config:{Promise:q.Promise},helpers:{}},s=r.helpers.noop=function(){},t=r.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}(),u=r.helpers.defaultError=function(a){throw a},v=(r.helpers.isPromise=function(a){return!!a&&!isFunction(a.subscribe)&&isFunction(a.then)},r.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0});isFunction=r.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 w=r.NotImplementedError=function(a){this.message=a||"This operation is not implemented",Error.call(this)};w.prototype=Error.prototype;var x=r.NotSupportedError=function(a){this.message=a||"This operation is not supported",Error.call(this)};x.prototype=Error.prototype;var y,z=r.helpers.notImplemented=function(){throw new w},A=r.helpers.notSupported=function(){throw new x},B={e:{}};r.config.longStackSupport=!1;var C=!1,D=b(function(){throw new Error})();C=!!D.e&&!!D.e.stack;var E,F=h(),G="From previous event:",H=({}.hasOwnProperty,Array.prototype.slice,r.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),I=(r.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]}},r.internals.addRef=function(a,b){return new db(function(c){return new I(b.getDisposable(),a.subscribe(c))})},r.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(!N(c[a]))throw new TypeError("Not a disposable");this.disposables=c,this.isDisposed=!1,this.length=c.length}),J=I.prototype;J.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},J.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},J.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 K=r.Disposable=function(a){this.isDisposed=!1,this.action=a||s};K.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var L=K.create=function(a){return new K(a)},M=K.empty={dispose:s},N=K.isDisposable=function(a){return a&&isFunction(a.dispose)},O=(K.checkDisposed=function(a){if(a.isDisposed)throw new ObjectDisposedError},r.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null});O.prototype.getDisposable=function(){return this.current},O.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()},O.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var P=r.SerialDisposable=function(){this.isDisposed=!1,this.current=null};P.prototype.getDisposable=function(){return this.current},P.prototype.setDisposable=function(a){var b=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),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=r.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||v,this.disposable=new O};Q.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Q.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Q.prototype.isCancelled=function(){return this.disposable.isDisposed},Q.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};{var R=r.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(),M}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=t,a.normalize=function(a){return 0>a&&(a=0),a},a}(),S=R.normalize;R.isScheduler}!function(a){function b(a,b){function c(b){function d(a,b){return g?f.remove(i):h=!0,e(b,c),M}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 I;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),M}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 I;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)}}(R.prototype),function(){R.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},R.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof q.setInterval)throw new x;b=S(b);var d=a,e=q.setInterval(function(){d=c(d)},b);return L(function(){q.clearInterval(e)})}}(R.prototype);var T,U,V=(r.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 O;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),R.immediate=function(){function a(a,b){return b(this,a)}return new R(t,a,A,A)}(),R.currentThread=function(){function a(){for(;e.length>0;){var a=e.shift();!a.isCancelled()&&a.invoke()}}function d(d,f){var g=new Q(this,d,f,this.now());if(e)e.push(g);else{e=[g];var h=b(a)();if(e=null,h===B)return c(h.e)}return g.disposable}var e,f=new R(t,d,A,A);return f.scheduleRequired=function(){return!e},f}()),W=function(){var a,b=s;if(q.setTimeout)a=q.setTimeout,b=q.clearTimeout;else{if(!q.WScript)throw new x;a=function(a,b){q.WScript.Sleep(b),a()}}return{setTimeout:a,clearTimeout:b}}(),X=W.setTimeout,Y=W.clearTimeout;!function(){function a(d){if(h)X(function(){a(d)},0);else{var e=g[d];if(e){h=!0;var f=b(e)();if(U(d),h=!1,f===B)return c(f.e)}}}function d(){if(!q.postMessage||q.importScripts)return!1;var a=!1,b=q.onmessage;return q.onmessage=function(){a=!0},q.postMessage("","*"),q.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;U=function(a){delete g[a]};var i=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),j="function"==typeof(j=p&&o&&p.setImmediate)&&!i.test(j)&&j;if(isFunction(j))T=function(b){var c=f++;return g[c]=b,j(function(){a(c)}),c};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))T=function(b){var c=f++;return g[c]=b,process.nextTick(function(){a(c)}),c};else if(d()){var k="ms.rx.schedule"+Math.random();q.addEventListener?q.addEventListener("message",e,!1):q.attachEvent?q.attachEvent("onmessage",e):q.onmessage=e,T=function(a){var b=f++;return g[b]=a,q.postMessage(k+currentId,"*"),b}}else if(q.MessageChannel){var l=new q.MessageChannel;l.port1.onmessage=function(b){a(b.data)},T=function(a){var b=f++;return g[b]=a,l.port2.postMessage(b),b}}else T="document"in q&&"onreadystatechange"in q.document.createElement("script")?function(b){var c=q.document.createElement("script"),d=f++;return g[d]=b,c.onreadystatechange=function(){a(d),c.onreadystatechange=null,c.parentNode.removeChild(c),c=null},q.document.documentElement.appendChild(c),d}:function(b){var c=f++;return g[c]=b,X(function(){a(c)},0),c}}();var Z,$=(R.timeout=R["default"]=function(){function a(a,b){var c=this,d=new O,e=T(function(){!d.isDisposed&&d.setDisposable(b(c,a))});return new I(d,L(function(){U(e)}))}function b(a,b,c){var d=this,e=R.normalize(b),f=new O;if(0===e)return d.scheduleWithState(a,c);var g=X(function(){!f.isDisposed&&f.setDisposable(c(d,a))},e);return new I(f,L(function(){Y(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new R(t,a,b,c)}(),r.Observer=function(){}),_=$.create=function(a,b,c){return a||(a=s),b||(b=u),c||(c=s),new bb(a,b,c)},ab=r.internals.AbstractObserver=function(a){function b(){this.isStopped=!1}return H(b,a),b.prototype.next=z,b.prototype.error=z,b.prototype.completed=z,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}($),bb=r.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return H(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}(ab),cb=r.Observable=function(){function a(a,b){return function(c){var e=c.onError;return c.onError=function(b){d(b,a),e.call(c,b)},b.call(a,c)}}function e(d){if(r.config.longStackSupport&&C){var e=b(c)(new Error).e;this.stack=e.stack.substring(e.stack.indexOf("\n")+1),this._subscribe=a(this,d)}else this._subscribe=d}return Z=e.prototype,e.isObservable=function(a){return a&&isFunction(a.subscribe)},Z.subscribe=Z.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:_(a,b,c))},Z.subscribeOnNext=function(a,b){return this._subscribe(_("undefined"!=typeof b?function(c){a.call(b,c)}:a))},Z.subscribeOnError=function(a,b){return this._subscribe(_(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},Z.subscribeOnCompleted=function(a,b){return this._subscribe(_(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},e}(),db=r.AnonymousObservable=function(a){function d(a){return a&&isFunction(a.dispose)?a:isFunction(a)?L(a):M}function e(a,e){var f=e[0],g=e[1],h=b(g.__subscribe).call(g,f);return h!==B||f.fail(B.e)?void f.setDisposable(d(h)):c(B.e)}function f(a){var b=new eb(a),c=[b,this];return V.scheduleRequired()?V.scheduleWithState(c,e):e(null,c),b}function g(b,c){this.source=c,this.__subscribe=b,a.call(this,f)}return H(g,a),g}(cb),eb=(r.ObservableBase=function(a){function d(a){return a&&isFunction(a.dispose)?a:isFunction(a)?L(a):M}function e(a,e){var f=e[0],g=e[1],h=b(g.subscribeCore).call(g,f);return h!==B||f.fail(B.e)?void f.setDisposable(d(h)):c(B.e)}function f(a){var b=new eb(a),c=[b,this];return V.scheduleRequired()?V.scheduleWithState(c,e):e(null,c),b}function g(){a.call(this,f)}return H(g,a),g.prototype.subscribeCore=z,g}(cb),function(a){function d(b){a.call(this),this.observer=b,this.m=new O}H(d,a);var e=d.prototype;return e.next=function(a){var d=b(this.observer.onNext).call(this.observer,a);d===B&&(this.dispose(),c(d.e))},e.error=function(a){var d=b(this.observer.onError).call(this.observer,a);this.dispose(),d===B&&c(d.e)},e.completed=function(){var a=b(this.observer.onCompleted).call(this.observer);this.dispose(),a===B&&c(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()},d}(ab));cb.create=function(a,b){return new db(a,b)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?(q.Rx=r,define(function(){return r})):k&&n?o?(n.exports=r).Rx=r:k.Rx=r:q.Rx=r;var fb=h()}).call(this);
3
+ //# sourceMappingURL=rx.core.map
@@ -0,0 +1,1242 @@
1
+ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
+
3
+ ;(function (factory) {
4
+ var objectTypes = {
5
+ 'function': true,
6
+ 'object': true
7
+ };
8
+
9
+ var
10
+ freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
11
+ freeSelf = objectTypes[typeof self] && self.Object && self,
12
+ freeWindow = objectTypes[typeof window] && window && window.Object && window,
13
+ freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
14
+ moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
15
+ freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
16
+
17
+ var root = root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
18
+
19
+ // Because of build optimizers
20
+ if (typeof define === 'function' && define.amd) {
21
+ define(['./rx.core'], function (Rx, exports) {
22
+ return factory(root, exports, Rx);
23
+ });
24
+ } else if (typeof module === 'object' && module && module.exports === freeExports) {
25
+ module.exports = factory(root, module.exports, require('./rx.core'));
26
+ } else {
27
+ root.Rx = factory(root, {}, root.Rx);
28
+ }
29
+ }.call(this, function (root, exp, Rx, undefined) {
30
+
31
+ // Defaults
32
+ var Observer = Rx.Observer,
33
+ Observable = Rx.Observable,
34
+ Disposable = Rx.Disposable,
35
+ disposableEmpty = Disposable.empty,
36
+ disposableCreate = Disposable.create,
37
+ CompositeDisposable = Rx.CompositeDisposable,
38
+ SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
39
+ Scheduler = Rx.Scheduler,
40
+ ScheduledItem = Rx.internals.ScheduledItem,
41
+ SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive,
42
+ inherits = Rx.internals.inherits,
43
+ notImplemented = Rx.helpers.notImplemented,
44
+ defaultComparer = Rx.helpers.defaultComparer = function (a, b) { return isEqual(a, b); };
45
+
46
+ /**
47
+ * Represents a notification to an observer.
48
+ */
49
+ var Notification = Rx.Notification = (function () {
50
+ function Notification(kind, value, exception, accept, acceptObservable, toString) {
51
+ this.kind = kind;
52
+ this.value = value;
53
+ this.exception = exception;
54
+ this._accept = accept;
55
+ this._acceptObservable = acceptObservable;
56
+ this.toString = toString;
57
+ }
58
+
59
+ /**
60
+ * Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
61
+ *
62
+ * @memberOf Notification
63
+ * @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
64
+ * @param {Function} onError Delegate to invoke for an OnError notification.
65
+ * @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
66
+ * @returns {Any} Result produced by the observation.
67
+ */
68
+ Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
69
+ return observerOrOnNext && typeof observerOrOnNext === 'object' ?
70
+ this._acceptObservable(observerOrOnNext) :
71
+ this._accept(observerOrOnNext, onError, onCompleted);
72
+ };
73
+
74
+ /**
75
+ * Returns an observable sequence with a single notification.
76
+ *
77
+ * @memberOf Notifications
78
+ * @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
79
+ * @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
80
+ */
81
+ Notification.prototype.toObservable = function (scheduler) {
82
+ var self = this;
83
+ isScheduler(scheduler) || (scheduler = immediateScheduler);
84
+ return new AnonymousObservable(function (observer) {
85
+ return scheduler.scheduleWithState(self, function (_, notification) {
86
+ notification._acceptObservable(observer);
87
+ notification.kind === 'N' && observer.onCompleted();
88
+ });
89
+ });
90
+ };
91
+
92
+ return Notification;
93
+ })();
94
+
95
+ /**
96
+ * Creates an object that represents an OnNext notification to an observer.
97
+ * @param {Any} value The value contained in the notification.
98
+ * @returns {Notification} The OnNext notification containing the value.
99
+ */
100
+ var notificationCreateOnNext = Notification.createOnNext = (function () {
101
+ function _accept(onNext) { return onNext(this.value); }
102
+ function _acceptObservable(observer) { return observer.onNext(this.value); }
103
+ function toString() { return 'OnNext(' + this.value + ')'; }
104
+
105
+ return function (value) {
106
+ return new Notification('N', value, null, _accept, _acceptObservable, toString);
107
+ };
108
+ }());
109
+
110
+ /**
111
+ * Creates an object that represents an OnError notification to an observer.
112
+ * @param {Any} error The exception contained in the notification.
113
+ * @returns {Notification} The OnError notification containing the exception.
114
+ */
115
+ var notificationCreateOnError = Notification.createOnError = (function () {
116
+ function _accept (onNext, onError) { return onError(this.exception); }
117
+ function _acceptObservable(observer) { return observer.onError(this.exception); }
118
+ function toString () { return 'OnError(' + this.exception + ')'; }
119
+
120
+ return function (e) {
121
+ return new Notification('E', null, e, _accept, _acceptObservable, toString);
122
+ };
123
+ }());
124
+
125
+ /**
126
+ * Creates an object that represents an OnCompleted notification to an observer.
127
+ * @returns {Notification} The OnCompleted notification.
128
+ */
129
+ var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
130
+ function _accept (onNext, onError, onCompleted) { return onCompleted(); }
131
+ function _acceptObservable(observer) { return observer.onCompleted(); }
132
+ function toString () { return 'OnCompleted()'; }
133
+
134
+ return function () {
135
+ return new Notification('C', null, null, _accept, _acceptObservable, toString);
136
+ };
137
+ }());
138
+
139
+ /** Used to determine if values are of the language type Object */
140
+ var dontEnums = ['toString',
141
+ 'toLocaleString',
142
+ 'valueOf',
143
+ 'hasOwnProperty',
144
+ 'isPrototypeOf',
145
+ 'propertyIsEnumerable',
146
+ 'constructor'],
147
+ dontEnumsLength = dontEnums.length;
148
+
149
+ /** `Object#toString` result shortcuts */
150
+ var argsClass = '[object Arguments]',
151
+ arrayClass = '[object Array]',
152
+ boolClass = '[object Boolean]',
153
+ dateClass = '[object Date]',
154
+ errorClass = '[object Error]',
155
+ funcClass = '[object Function]',
156
+ numberClass = '[object Number]',
157
+ objectClass = '[object Object]',
158
+ regexpClass = '[object RegExp]',
159
+ stringClass = '[object String]';
160
+
161
+ var toString = Object.prototype.toString,
162
+ hasOwnProperty = Object.prototype.hasOwnProperty,
163
+ supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
164
+ supportNodeClass,
165
+ errorProto = Error.prototype,
166
+ objectProto = Object.prototype,
167
+ stringProto = String.prototype,
168
+ propertyIsEnumerable = objectProto.propertyIsEnumerable;
169
+
170
+ try {
171
+ supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
172
+ } catch (e) {
173
+ supportNodeClass = true;
174
+ }
175
+
176
+ var nonEnumProps = {};
177
+ nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
178
+ nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
179
+ nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
180
+ nonEnumProps[objectClass] = { 'constructor': true };
181
+
182
+ var support = {};
183
+ (function () {
184
+ var ctor = function() { this.x = 1; },
185
+ props = [];
186
+
187
+ ctor.prototype = { 'valueOf': 1, 'y': 1 };
188
+ for (var key in new ctor) { props.push(key); }
189
+ for (key in arguments) { }
190
+
191
+ // Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
192
+ support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
193
+
194
+ // Detect if `prototype` properties are enumerable by default.
195
+ support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
196
+
197
+ // Detect if `arguments` object indexes are non-enumerable
198
+ support.nonEnumArgs = key != 0;
199
+
200
+ // Detect if properties shadowing those on `Object.prototype` are non-enumerable.
201
+ support.nonEnumShadows = !/valueOf/.test(props);
202
+ }(1));
203
+
204
+ var isObject = Rx.internals.isObject = function(value) {
205
+ var type = typeof value;
206
+ return value && (type == 'function' || type == 'object') || false;
207
+ };
208
+
209
+ function keysIn(object) {
210
+ var result = [];
211
+ if (!isObject(object)) {
212
+ return result;
213
+ }
214
+ if (support.nonEnumArgs && object.length && isArguments(object)) {
215
+ object = slice.call(object);
216
+ }
217
+ var skipProto = support.enumPrototypes && typeof object == 'function',
218
+ skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
219
+
220
+ for (var key in object) {
221
+ if (!(skipProto && key == 'prototype') &&
222
+ !(skipErrorProps && (key == 'message' || key == 'name'))) {
223
+ result.push(key);
224
+ }
225
+ }
226
+
227
+ if (support.nonEnumShadows && object !== objectProto) {
228
+ var ctor = object.constructor,
229
+ index = -1,
230
+ length = dontEnumsLength;
231
+
232
+ if (object === (ctor && ctor.prototype)) {
233
+ var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
234
+ nonEnum = nonEnumProps[className];
235
+ }
236
+ while (++index < length) {
237
+ key = dontEnums[index];
238
+ if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
239
+ result.push(key);
240
+ }
241
+ }
242
+ }
243
+ return result;
244
+ }
245
+
246
+ function internalFor(object, callback, keysFunc) {
247
+ var index = -1,
248
+ props = keysFunc(object),
249
+ length = props.length;
250
+
251
+ while (++index < length) {
252
+ var key = props[index];
253
+ if (callback(object[key], key, object) === false) {
254
+ break;
255
+ }
256
+ }
257
+ return object;
258
+ }
259
+
260
+ function internalForIn(object, callback) {
261
+ return internalFor(object, callback, keysIn);
262
+ }
263
+
264
+ function isNode(value) {
265
+ // IE < 9 presents DOM nodes as `Object` objects except they have `toString`
266
+ // methods that are `typeof` "string" and still can coerce nodes to strings
267
+ return typeof value.toString != 'function' && typeof (value + '') == 'string';
268
+ }
269
+
270
+ var isArguments = function(value) {
271
+ return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
272
+ }
273
+
274
+ // fallback for browsers that can't detect `arguments` objects by [[Class]]
275
+ if (!supportsArgsClass) {
276
+ isArguments = function(value) {
277
+ return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
278
+ };
279
+ }
280
+
281
+ var isEqual = Rx.internals.isEqual = function (x, y) {
282
+ return deepEquals(x, y, [], []);
283
+ };
284
+
285
+ /** @private
286
+ * Used for deep comparison
287
+ **/
288
+ function deepEquals(a, b, stackA, stackB) {
289
+ // exit early for identical values
290
+ if (a === b) {
291
+ // treat `+0` vs. `-0` as not equal
292
+ return a !== 0 || (1 / a == 1 / b);
293
+ }
294
+
295
+ var type = typeof a,
296
+ otherType = typeof b;
297
+
298
+ // exit early for unlike primitive values
299
+ if (a === a && (a == null || b == null ||
300
+ (type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
301
+ return false;
302
+ }
303
+
304
+ // compare [[Class]] names
305
+ var className = toString.call(a),
306
+ otherClass = toString.call(b);
307
+
308
+ if (className == argsClass) {
309
+ className = objectClass;
310
+ }
311
+ if (otherClass == argsClass) {
312
+ otherClass = objectClass;
313
+ }
314
+ if (className != otherClass) {
315
+ return false;
316
+ }
317
+ switch (className) {
318
+ case boolClass:
319
+ case dateClass:
320
+ // coerce dates and booleans to numbers, dates to milliseconds and booleans
321
+ // to `1` or `0` treating invalid dates coerced to `NaN` as not equal
322
+ return +a == +b;
323
+
324
+ case numberClass:
325
+ // treat `NaN` vs. `NaN` as equal
326
+ return (a != +a) ?
327
+ b != +b :
328
+ // but treat `-0` vs. `+0` as not equal
329
+ (a == 0 ? (1 / a == 1 / b) : a == +b);
330
+
331
+ case regexpClass:
332
+ case stringClass:
333
+ // coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
334
+ // treat string primitives and their corresponding object instances as equal
335
+ return a == String(b);
336
+ }
337
+ var isArr = className == arrayClass;
338
+ if (!isArr) {
339
+
340
+ // exit for functions and DOM nodes
341
+ if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
342
+ return false;
343
+ }
344
+ // in older versions of Opera, `arguments` objects have `Array` constructors
345
+ var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
346
+ ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
347
+
348
+ // non `Object` object instances with different constructors are not equal
349
+ if (ctorA != ctorB &&
350
+ !(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
351
+ !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
352
+ ('constructor' in a && 'constructor' in b)
353
+ ) {
354
+ return false;
355
+ }
356
+ }
357
+ // assume cyclic structures are equal
358
+ // the algorithm for detecting cyclic structures is adapted from ES 5.1
359
+ // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
360
+ var initedStack = !stackA;
361
+ stackA || (stackA = []);
362
+ stackB || (stackB = []);
363
+
364
+ var length = stackA.length;
365
+ while (length--) {
366
+ if (stackA[length] == a) {
367
+ return stackB[length] == b;
368
+ }
369
+ }
370
+ var size = 0;
371
+ var result = true;
372
+
373
+ // add `a` and `b` to the stack of traversed objects
374
+ stackA.push(a);
375
+ stackB.push(b);
376
+
377
+ // recursively compare objects and arrays (susceptible to call stack limits)
378
+ if (isArr) {
379
+ // compare lengths to determine if a deep comparison is necessary
380
+ length = a.length;
381
+ size = b.length;
382
+ result = size == length;
383
+
384
+ if (result) {
385
+ // deep compare the contents, ignoring non-numeric properties
386
+ while (size--) {
387
+ var index = length,
388
+ value = b[size];
389
+
390
+ if (!(result = deepEquals(a[size], value, stackA, stackB))) {
391
+ break;
392
+ }
393
+ }
394
+ }
395
+ }
396
+ else {
397
+ // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
398
+ // which, in this case, is more costly
399
+ internalForIn(b, function(value, key, b) {
400
+ if (hasOwnProperty.call(b, key)) {
401
+ // count the number of properties.
402
+ size++;
403
+ // deep compare each property value.
404
+ return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
405
+ }
406
+ });
407
+
408
+ if (result) {
409
+ // ensure both objects have the same number of properties
410
+ internalForIn(a, function(value, key, a) {
411
+ if (hasOwnProperty.call(a, key)) {
412
+ // `size` will be `-1` if `a` has more properties than `b`
413
+ return (result = --size > -1);
414
+ }
415
+ });
416
+ }
417
+ }
418
+ stackA.pop();
419
+ stackB.pop();
420
+
421
+ return result;
422
+ }
423
+
424
+ var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
425
+ function tick(command, recurse) {
426
+ recurse(0, this._period);
427
+ try {
428
+ this._state = this._action(this._state);
429
+ } catch (e) {
430
+ this._cancel.dispose();
431
+ throw e;
432
+ }
433
+ }
434
+
435
+ function SchedulePeriodicRecursive(scheduler, state, period, action) {
436
+ this._scheduler = scheduler;
437
+ this._state = state;
438
+ this._period = period;
439
+ this._action = action;
440
+ }
441
+
442
+ SchedulePeriodicRecursive.prototype.start = function () {
443
+ var d = new SingleAssignmentDisposable();
444
+ this._cancel = d;
445
+ d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
446
+
447
+ return d;
448
+ };
449
+
450
+ return SchedulePeriodicRecursive;
451
+ }());
452
+
453
+ // Collections
454
+ function IndexedItem(id, value) {
455
+ this.id = id;
456
+ this.value = value;
457
+ }
458
+
459
+ IndexedItem.prototype.compareTo = function (other) {
460
+ var c = this.value.compareTo(other.value);
461
+ c === 0 && (c = this.id - other.id);
462
+ return c;
463
+ };
464
+
465
+ // Priority Queue for Scheduling
466
+ var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
467
+ this.items = new Array(capacity);
468
+ this.length = 0;
469
+ };
470
+
471
+ var priorityProto = PriorityQueue.prototype;
472
+ priorityProto.isHigherPriority = function (left, right) {
473
+ return this.items[left].compareTo(this.items[right]) < 0;
474
+ };
475
+
476
+ priorityProto.percolate = function (index) {
477
+ if (index >= this.length || index < 0) { return; }
478
+ var parent = index - 1 >> 1;
479
+ if (parent < 0 || parent === index) { return; }
480
+ if (this.isHigherPriority(index, parent)) {
481
+ var temp = this.items[index];
482
+ this.items[index] = this.items[parent];
483
+ this.items[parent] = temp;
484
+ this.percolate(parent);
485
+ }
486
+ };
487
+
488
+ priorityProto.heapify = function (index) {
489
+ +index || (index = 0);
490
+ if (index >= this.length || index < 0) { return; }
491
+ var left = 2 * index + 1,
492
+ right = 2 * index + 2,
493
+ first = index;
494
+ if (left < this.length && this.isHigherPriority(left, first)) {
495
+ first = left;
496
+ }
497
+ if (right < this.length && this.isHigherPriority(right, first)) {
498
+ first = right;
499
+ }
500
+ if (first !== index) {
501
+ var temp = this.items[index];
502
+ this.items[index] = this.items[first];
503
+ this.items[first] = temp;
504
+ this.heapify(first);
505
+ }
506
+ };
507
+
508
+ priorityProto.peek = function () { return this.items[0].value; };
509
+
510
+ priorityProto.removeAt = function (index) {
511
+ this.items[index] = this.items[--this.length];
512
+ this.items[this.length] = undefined;
513
+ this.heapify();
514
+ };
515
+
516
+ priorityProto.dequeue = function () {
517
+ var result = this.peek();
518
+ this.removeAt(0);
519
+ return result;
520
+ };
521
+
522
+ priorityProto.enqueue = function (item) {
523
+ var index = this.length++;
524
+ this.items[index] = new IndexedItem(PriorityQueue.count++, item);
525
+ this.percolate(index);
526
+ };
527
+
528
+ priorityProto.remove = function (item) {
529
+ for (var i = 0; i < this.length; i++) {
530
+ if (this.items[i].value === item) {
531
+ this.removeAt(i);
532
+ return true;
533
+ }
534
+ }
535
+ return false;
536
+ };
537
+ PriorityQueue.count = 0;
538
+
539
+ /** Provides a set of extension methods for virtual time scheduling. */
540
+ var VirtualTimeScheduler = Rx.VirtualTimeScheduler = (function (__super__) {
541
+
542
+ function localNow() {
543
+ return this.toDateTimeOffset(this.clock);
544
+ }
545
+
546
+ function scheduleNow(state, action) {
547
+ return this.scheduleAbsoluteWithState(state, this.clock, action);
548
+ }
549
+
550
+ function scheduleRelative(state, dueTime, action) {
551
+ return this.scheduleRelativeWithState(state, this.toRelative(dueTime), action);
552
+ }
553
+
554
+ function scheduleAbsolute(state, dueTime, action) {
555
+ return this.scheduleRelativeWithState(state, this.toRelative(dueTime - this.now()), action);
556
+ }
557
+
558
+ function invokeAction(scheduler, action) {
559
+ action();
560
+ return disposableEmpty;
561
+ }
562
+
563
+ inherits(VirtualTimeScheduler, __super__);
564
+
565
+ /**
566
+ * Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
567
+ *
568
+ * @constructor
569
+ * @param {Number} initialClock Initial value for the clock.
570
+ * @param {Function} comparer Comparer to determine causality of events based on absolute time.
571
+ */
572
+ function VirtualTimeScheduler(initialClock, comparer) {
573
+ this.clock = initialClock;
574
+ this.comparer = comparer;
575
+ this.isEnabled = false;
576
+ this.queue = new PriorityQueue(1024);
577
+ __super__.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
578
+ }
579
+
580
+ var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;
581
+
582
+ /**
583
+ * Adds a relative time value to an absolute time value.
584
+ * @param {Number} absolute Absolute virtual time value.
585
+ * @param {Number} relative Relative virtual time value to add.
586
+ * @return {Number} Resulting absolute virtual time sum value.
587
+ */
588
+ VirtualTimeSchedulerPrototype.add = notImplemented;
589
+
590
+ /**
591
+ * Converts an absolute time to a number
592
+ * @param {Any} The absolute time.
593
+ * @returns {Number} The absolute time in ms
594
+ */
595
+ VirtualTimeSchedulerPrototype.toDateTimeOffset = notImplemented;
596
+
597
+ /**
598
+ * Converts the TimeSpan value to a relative virtual time value.
599
+ * @param {Number} timeSpan TimeSpan value to convert.
600
+ * @return {Number} Corresponding relative virtual time value.
601
+ */
602
+ VirtualTimeSchedulerPrototype.toRelative = notImplemented;
603
+
604
+ /**
605
+ * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
606
+ * @param {Mixed} state Initial state passed to the action upon the first iteration.
607
+ * @param {Number} period Period for running the work periodically.
608
+ * @param {Function} action Action to be executed, potentially updating the state.
609
+ * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
610
+ */
611
+ VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) {
612
+ var s = new SchedulePeriodicRecursive(this, state, period, action);
613
+ return s.start();
614
+ };
615
+
616
+ /**
617
+ * Schedules an action to be executed after dueTime.
618
+ * @param {Mixed} state State passed to the action to be executed.
619
+ * @param {Number} dueTime Relative time after which to execute the action.
620
+ * @param {Function} action Action to be executed.
621
+ * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
622
+ */
623
+ VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) {
624
+ var runAt = this.add(this.clock, dueTime);
625
+ return this.scheduleAbsoluteWithState(state, runAt, action);
626
+ };
627
+
628
+ /**
629
+ * Schedules an action to be executed at dueTime.
630
+ * @param {Number} dueTime Relative time after which to execute the action.
631
+ * @param {Function} action Action to be executed.
632
+ * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
633
+ */
634
+ VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) {
635
+ return this.scheduleRelativeWithState(action, dueTime, invokeAction);
636
+ };
637
+
638
+ /**
639
+ * Starts the virtual time scheduler.
640
+ */
641
+ VirtualTimeSchedulerPrototype.start = function () {
642
+ if (!this.isEnabled) {
643
+ this.isEnabled = true;
644
+ do {
645
+ var next = this.getNext();
646
+ if (next !== null) {
647
+ this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
648
+ next.invoke();
649
+ } else {
650
+ this.isEnabled = false;
651
+ }
652
+ } while (this.isEnabled);
653
+ }
654
+ };
655
+
656
+ /**
657
+ * Stops the virtual time scheduler.
658
+ */
659
+ VirtualTimeSchedulerPrototype.stop = function () {
660
+ this.isEnabled = false;
661
+ };
662
+
663
+ /**
664
+ * Advances the scheduler's clock to the specified time, running all work till that point.
665
+ * @param {Number} time Absolute time to advance the scheduler's clock to.
666
+ */
667
+ VirtualTimeSchedulerPrototype.advanceTo = function (time) {
668
+ var dueToClock = this.comparer(this.clock, time);
669
+ if (this.comparer(this.clock, time) > 0) { throw new ArgumentOutOfRangeError(); }
670
+ if (dueToClock === 0) { return; }
671
+ if (!this.isEnabled) {
672
+ this.isEnabled = true;
673
+ do {
674
+ var next = this.getNext();
675
+ if (next !== null && this.comparer(next.dueTime, time) <= 0) {
676
+ this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
677
+ next.invoke();
678
+ } else {
679
+ this.isEnabled = false;
680
+ }
681
+ } while (this.isEnabled);
682
+ this.clock = time;
683
+ }
684
+ };
685
+
686
+ /**
687
+ * Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
688
+ * @param {Number} time Relative time to advance the scheduler's clock by.
689
+ */
690
+ VirtualTimeSchedulerPrototype.advanceBy = function (time) {
691
+ var dt = this.add(this.clock, time),
692
+ dueToClock = this.comparer(this.clock, dt);
693
+ if (dueToClock > 0) { throw new ArgumentOutOfRangeError(); }
694
+ if (dueToClock === 0) { return; }
695
+
696
+ this.advanceTo(dt);
697
+ };
698
+
699
+ /**
700
+ * Advances the scheduler's clock by the specified relative time.
701
+ * @param {Number} time Relative time to advance the scheduler's clock by.
702
+ */
703
+ VirtualTimeSchedulerPrototype.sleep = function (time) {
704
+ var dt = this.add(this.clock, time);
705
+ if (this.comparer(this.clock, dt) >= 0) { throw new ArgumentOutOfRangeError(); }
706
+
707
+ this.clock = dt;
708
+ };
709
+
710
+ /**
711
+ * Gets the next scheduled item to be executed.
712
+ * @returns {ScheduledItem} The next scheduled item.
713
+ */
714
+ VirtualTimeSchedulerPrototype.getNext = function () {
715
+ while (this.queue.length > 0) {
716
+ var next = this.queue.peek();
717
+ if (next.isCancelled()) {
718
+ this.queue.dequeue();
719
+ } else {
720
+ return next;
721
+ }
722
+ }
723
+ return null;
724
+ };
725
+
726
+ /**
727
+ * Schedules an action to be executed at dueTime.
728
+ * @param {Scheduler} scheduler Scheduler to execute the action on.
729
+ * @param {Number} dueTime Absolute time at which to execute the action.
730
+ * @param {Function} action Action to be executed.
731
+ * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
732
+ */
733
+ VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) {
734
+ return this.scheduleAbsoluteWithState(action, dueTime, invokeAction);
735
+ };
736
+
737
+ /**
738
+ * Schedules an action to be executed at dueTime.
739
+ * @param {Mixed} state State passed to the action to be executed.
740
+ * @param {Number} dueTime Absolute time at which to execute the action.
741
+ * @param {Function} action Action to be executed.
742
+ * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
743
+ */
744
+ VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
745
+ var self = this;
746
+
747
+ function run(scheduler, state1) {
748
+ self.queue.remove(si);
749
+ return action(scheduler, state1);
750
+ }
751
+
752
+ var si = new ScheduledItem(this, state, run, dueTime, this.comparer);
753
+ this.queue.enqueue(si);
754
+
755
+ return si.disposable;
756
+ };
757
+
758
+ return VirtualTimeScheduler;
759
+ }(Scheduler));
760
+
761
+ function OnNextPredicate(predicate) {
762
+ this.predicate = predicate;
763
+ };
764
+
765
+ OnNextPredicate.prototype.equals = function (other) {
766
+ if (other === this) { return true; }
767
+ if (other == null) { return false; }
768
+ if (other.kind !== 'N') { return false; }
769
+ return this.predicate(other.value);
770
+ };
771
+
772
+ function OnErrorPredicate(predicate) {
773
+ this.predicate = predicate;
774
+ };
775
+
776
+ OnErrorPredicate.prototype.equals = function (other) {
777
+ if (other === this) { return true; }
778
+ if (other == null) { return false; }
779
+ if (other.kind !== 'E') { return false; }
780
+ return this.predicate(other.exception);
781
+ };
782
+
783
+ var ReactiveTest = Rx.ReactiveTest = {
784
+ /** Default virtual time used for creation of observable sequences in unit tests. */
785
+ created: 100,
786
+ /** Default virtual time used to subscribe to observable sequences in unit tests. */
787
+ subscribed: 200,
788
+ /** Default virtual time used to dispose subscriptions in unit tests. */
789
+ disposed: 1000,
790
+
791
+ /**
792
+ * Factory method for an OnNext notification record at a given time with a given value or a predicate function.
793
+ *
794
+ * 1 - ReactiveTest.onNext(200, 42);
795
+ * 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; });
796
+ *
797
+ * @param ticks Recorded virtual time the OnNext notification occurs.
798
+ * @param value Recorded value stored in the OnNext notification or a predicate.
799
+ * @return Recorded OnNext notification.
800
+ */
801
+ onNext: function (ticks, value) {
802
+ return typeof value === 'function' ?
803
+ new Recorded(ticks, new OnNextPredicate(value)) :
804
+ new Recorded(ticks, Notification.createOnNext(value));
805
+ },
806
+ /**
807
+ * Factory method for an OnError notification record at a given time with a given error.
808
+ *
809
+ * 1 - ReactiveTest.onNext(200, new Error('error'));
810
+ * 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; });
811
+ *
812
+ * @param ticks Recorded virtual time the OnError notification occurs.
813
+ * @param exception Recorded exception stored in the OnError notification.
814
+ * @return Recorded OnError notification.
815
+ */
816
+ onError: function (ticks, error) {
817
+ return typeof error === 'function' ?
818
+ new Recorded(ticks, new OnErrorPredicate(error)) :
819
+ new Recorded(ticks, Notification.createOnError(error));
820
+ },
821
+ /**
822
+ * Factory method for an OnCompleted notification record at a given time.
823
+ *
824
+ * @param ticks Recorded virtual time the OnCompleted notification occurs.
825
+ * @return Recorded OnCompleted notification.
826
+ */
827
+ onCompleted: function (ticks) {
828
+ return new Recorded(ticks, Notification.createOnCompleted());
829
+ },
830
+ /**
831
+ * Factory method for a subscription record based on a given subscription and disposal time.
832
+ *
833
+ * @param start Virtual time indicating when the subscription was created.
834
+ * @param end Virtual time indicating when the subscription was disposed.
835
+ * @return Subscription object.
836
+ */
837
+ subscribe: function (start, end) {
838
+ return new Subscription(start, end);
839
+ }
840
+ };
841
+
842
+ /**
843
+ * Creates a new object recording the production of the specified value at the given virtual time.
844
+ *
845
+ * @constructor
846
+ * @param {Number} time Virtual time the value was produced on.
847
+ * @param {Mixed} value Value that was produced.
848
+ * @param {Function} comparer An optional comparer.
849
+ */
850
+ var Recorded = Rx.Recorded = function (time, value, comparer) {
851
+ this.time = time;
852
+ this.value = value;
853
+ this.comparer = comparer || defaultComparer;
854
+ };
855
+
856
+ /**
857
+ * Checks whether the given recorded object is equal to the current instance.
858
+ *
859
+ * @param {Recorded} other Recorded object to check for equality.
860
+ * @returns {Boolean} true if both objects are equal; false otherwise.
861
+ */
862
+ Recorded.prototype.equals = function (other) {
863
+ return this.time === other.time && this.comparer(this.value, other.value);
864
+ };
865
+
866
+ /**
867
+ * Returns a string representation of the current Recorded value.
868
+ *
869
+ * @returns {String} String representation of the current Recorded value.
870
+ */
871
+ Recorded.prototype.toString = function () {
872
+ return this.value.toString() + '@' + this.time;
873
+ };
874
+
875
+ /**
876
+ * Creates a new subscription object with the given virtual subscription and unsubscription time.
877
+ *
878
+ * @constructor
879
+ * @param {Number} subscribe Virtual time at which the subscription occurred.
880
+ * @param {Number} unsubscribe Virtual time at which the unsubscription occurred.
881
+ */
882
+ var Subscription = Rx.Subscription = function (start, end) {
883
+ this.subscribe = start;
884
+ this.unsubscribe = end || Number.MAX_VALUE;
885
+ };
886
+
887
+ /**
888
+ * Checks whether the given subscription is equal to the current instance.
889
+ * @param other Subscription object to check for equality.
890
+ * @returns {Boolean} true if both objects are equal; false otherwise.
891
+ */
892
+ Subscription.prototype.equals = function (other) {
893
+ return this.subscribe === other.subscribe && this.unsubscribe === other.unsubscribe;
894
+ };
895
+
896
+ /**
897
+ * Returns a string representation of the current Subscription value.
898
+ * @returns {String} String representation of the current Subscription value.
899
+ */
900
+ Subscription.prototype.toString = function () {
901
+ return '(' + this.subscribe + ', ' + (this.unsubscribe === Number.MAX_VALUE ? 'Infinite' : this.unsubscribe) + ')';
902
+ };
903
+
904
+ var MockDisposable = Rx.MockDisposable = function (scheduler) {
905
+ this.scheduler = scheduler;
906
+ this.disposes = [];
907
+ this.disposes.push(this.scheduler.clock);
908
+ };
909
+
910
+ MockDisposable.prototype.dispose = function () {
911
+ this.disposes.push(this.scheduler.clock);
912
+ };
913
+
914
+ var MockObserver = (function (__super__) {
915
+ inherits(MockObserver, __super__);
916
+
917
+ function MockObserver(scheduler) {
918
+ __super__.call(this);
919
+ this.scheduler = scheduler;
920
+ this.messages = [];
921
+ }
922
+
923
+ var MockObserverPrototype = MockObserver.prototype;
924
+
925
+ MockObserverPrototype.onNext = function (value) {
926
+ this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnNext(value)));
927
+ };
928
+
929
+ MockObserverPrototype.onError = function (exception) {
930
+ this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnError(exception)));
931
+ };
932
+
933
+ MockObserverPrototype.onCompleted = function () {
934
+ this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnCompleted()));
935
+ };
936
+
937
+ return MockObserver;
938
+ })(Observer);
939
+
940
+ function MockPromise(scheduler, messages) {
941
+ var self = this;
942
+ this.scheduler = scheduler;
943
+ this.messages = messages;
944
+ this.subscriptions = [];
945
+ this.observers = [];
946
+ for (var i = 0, len = this.messages.length; i < len; i++) {
947
+ var message = this.messages[i],
948
+ notification = message.value;
949
+ (function (innerNotification) {
950
+ scheduler.scheduleAbsoluteWithState(null, message.time, function () {
951
+ var obs = self.observers.slice(0);
952
+
953
+ for (var j = 0, jLen = obs.length; j < jLen; j++) {
954
+ innerNotification.accept(obs[j]);
955
+ }
956
+ return disposableEmpty;
957
+ });
958
+ })(notification);
959
+ }
960
+ }
961
+
962
+ MockPromise.prototype.then = function (onResolved, onRejected) {
963
+ var self = this;
964
+
965
+ this.subscriptions.push(new Subscription(this.scheduler.clock));
966
+ var index = this.subscriptions.length - 1;
967
+
968
+ var newPromise;
969
+
970
+ var observer = Rx.Observer.create(
971
+ function (x) {
972
+ var retValue = onResolved(x);
973
+ if (retValue && typeof retValue.then === 'function') {
974
+ newPromise = retValue;
975
+ } else {
976
+ var ticks = self.scheduler.clock;
977
+ newPromise = new MockPromise(self.scheduler, [Rx.ReactiveTest.onNext(ticks, undefined), Rx.ReactiveTest.onCompleted(ticks)]);
978
+ }
979
+ var idx = self.observers.indexOf(observer);
980
+ self.observers.splice(idx, 1);
981
+ self.subscriptions[index] = new Subscription(self.subscriptions[index].subscribe, self.scheduler.clock);
982
+ },
983
+ function (err) {
984
+ onRejected(err);
985
+ var idx = self.observers.indexOf(observer);
986
+ self.observers.splice(idx, 1);
987
+ self.subscriptions[index] = new Subscription(self.subscriptions[index].subscribe, self.scheduler.clock);
988
+ }
989
+ );
990
+ this.observers.push(observer);
991
+
992
+ return newPromise || new MockPromise(this.scheduler, this.messages);
993
+ };
994
+
995
+ var HotObservable = (function (__super__) {
996
+
997
+ function subscribe(observer) {
998
+ var observable = this;
999
+ this.observers.push(observer);
1000
+ this.subscriptions.push(new Subscription(this.scheduler.clock));
1001
+ var index = this.subscriptions.length - 1;
1002
+ return disposableCreate(function () {
1003
+ var idx = observable.observers.indexOf(observer);
1004
+ observable.observers.splice(idx, 1);
1005
+ observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);
1006
+ });
1007
+ }
1008
+
1009
+ inherits(HotObservable, __super__);
1010
+
1011
+ function HotObservable(scheduler, messages) {
1012
+ __super__.call(this, subscribe);
1013
+ var message, notification, observable = this;
1014
+ this.scheduler = scheduler;
1015
+ this.messages = messages;
1016
+ this.subscriptions = [];
1017
+ this.observers = [];
1018
+ for (var i = 0, len = this.messages.length; i < len; i++) {
1019
+ message = this.messages[i];
1020
+ notification = message.value;
1021
+ (function (innerNotification) {
1022
+ scheduler.scheduleAbsoluteWithState(null, message.time, function () {
1023
+ var obs = observable.observers.slice(0);
1024
+
1025
+ for (var j = 0, jLen = obs.length; j < jLen; j++) {
1026
+ innerNotification.accept(obs[j]);
1027
+ }
1028
+ return disposableEmpty;
1029
+ });
1030
+ })(notification);
1031
+ }
1032
+ }
1033
+
1034
+ return HotObservable;
1035
+ })(Observable);
1036
+
1037
+ var ColdObservable = (function (__super__) {
1038
+
1039
+ function subscribe(observer) {
1040
+ var message, notification, observable = this;
1041
+ this.subscriptions.push(new Subscription(this.scheduler.clock));
1042
+ var index = this.subscriptions.length - 1;
1043
+ var d = new CompositeDisposable();
1044
+ for (var i = 0, len = this.messages.length; i < len; i++) {
1045
+ message = this.messages[i];
1046
+ notification = message.value;
1047
+ (function (innerNotification) {
1048
+ d.add(observable.scheduler.scheduleRelativeWithState(null, message.time, function () {
1049
+ innerNotification.accept(observer);
1050
+ return disposableEmpty;
1051
+ }));
1052
+ })(notification);
1053
+ }
1054
+ return disposableCreate(function () {
1055
+ observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);
1056
+ d.dispose();
1057
+ });
1058
+ }
1059
+
1060
+ inherits(ColdObservable, __super__);
1061
+
1062
+ function ColdObservable(scheduler, messages) {
1063
+ __super__.call(this, subscribe);
1064
+ this.scheduler = scheduler;
1065
+ this.messages = messages;
1066
+ this.subscriptions = [];
1067
+ }
1068
+
1069
+ return ColdObservable;
1070
+ })(Observable);
1071
+
1072
+ /** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */
1073
+ Rx.TestScheduler = (function (__super__) {
1074
+ inherits(TestScheduler, __super__);
1075
+
1076
+ function baseComparer(x, y) {
1077
+ return x > y ? 1 : (x < y ? -1 : 0);
1078
+ }
1079
+
1080
+ function TestScheduler() {
1081
+ __super__.call(this, 0, baseComparer);
1082
+ }
1083
+
1084
+ /**
1085
+ * Schedules an action to be executed at the specified virtual time.
1086
+ *
1087
+ * @param state State passed to the action to be executed.
1088
+ * @param dueTime Absolute virtual time at which to execute the action.
1089
+ * @param action Action to be executed.
1090
+ * @return Disposable object used to cancel the scheduled action (best effort).
1091
+ */
1092
+ TestScheduler.prototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
1093
+ dueTime <= this.clock && (dueTime = this.clock + 1);
1094
+ return __super__.prototype.scheduleAbsoluteWithState.call(this, state, dueTime, action);
1095
+ };
1096
+ /**
1097
+ * Adds a relative virtual time to an absolute virtual time value.
1098
+ *
1099
+ * @param absolute Absolute virtual time value.
1100
+ * @param relative Relative virtual time value to add.
1101
+ * @return Resulting absolute virtual time sum value.
1102
+ */
1103
+ TestScheduler.prototype.add = function (absolute, relative) {
1104
+ return absolute + relative;
1105
+ };
1106
+ /**
1107
+ * Converts the absolute virtual time value to a DateTimeOffset value.
1108
+ *
1109
+ * @param absolute Absolute virtual time value to convert.
1110
+ * @return Corresponding DateTimeOffset value.
1111
+ */
1112
+ TestScheduler.prototype.toDateTimeOffset = function (absolute) {
1113
+ return new Date(absolute).getTime();
1114
+ };
1115
+ /**
1116
+ * Converts the TimeSpan value to a relative virtual time value.
1117
+ *
1118
+ * @param timeSpan TimeSpan value to convert.
1119
+ * @return Corresponding relative virtual time value.
1120
+ */
1121
+ TestScheduler.prototype.toRelative = function (timeSpan) {
1122
+ return timeSpan;
1123
+ };
1124
+ /**
1125
+ * Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription.
1126
+ *
1127
+ * @param create Factory method to create an observable sequence.
1128
+ * @param created Virtual time at which to invoke the factory to create an observable sequence.
1129
+ * @param subscribed Virtual time at which to subscribe to the created observable sequence.
1130
+ * @param disposed Virtual time at which to dispose the subscription.
1131
+ * @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.
1132
+ */
1133
+ TestScheduler.prototype.startWithTiming = function (create, created, subscribed, disposed) {
1134
+ var observer = this.createObserver(), source, subscription;
1135
+
1136
+ this.scheduleAbsoluteWithState(null, created, function () {
1137
+ source = create();
1138
+ return disposableEmpty;
1139
+ });
1140
+
1141
+ this.scheduleAbsoluteWithState(null, subscribed, function () {
1142
+ subscription = source.subscribe(observer);
1143
+ return disposableEmpty;
1144
+ });
1145
+
1146
+ this.scheduleAbsoluteWithState(null, disposed, function () {
1147
+ subscription.dispose();
1148
+ return disposableEmpty;
1149
+ });
1150
+
1151
+ this.start();
1152
+
1153
+ return observer;
1154
+ };
1155
+
1156
+ /**
1157
+ * Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function.
1158
+ * Default virtual times are used for factory invocation and sequence subscription.
1159
+ *
1160
+ * @param create Factory method to create an observable sequence.
1161
+ * @param disposed Virtual time at which to dispose the subscription.
1162
+ * @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.
1163
+ */
1164
+ TestScheduler.prototype.startWithDispose = function (create, disposed) {
1165
+ return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, disposed);
1166
+ };
1167
+
1168
+ /**
1169
+ * 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.
1170
+ *
1171
+ * @param create Factory method to create an observable sequence.
1172
+ * @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.
1173
+ */
1174
+ TestScheduler.prototype.startWithCreate = function (create) {
1175
+ return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, ReactiveTest.disposed);
1176
+ };
1177
+
1178
+ /**
1179
+ * Creates a hot observable using the specified timestamped notification messages either as an array or arguments.
1180
+ * @param messages Notifications to surface through the created sequence at their specified absolute virtual times.
1181
+ * @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications.
1182
+ */
1183
+ TestScheduler.prototype.createHotObservable = function () {
1184
+ var len = arguments.length, args;
1185
+ if (Array.isArray(arguments[0])) {
1186
+ args = arguments[0];
1187
+ } else {
1188
+ args = new Array(len);
1189
+ for (var i = 0; i < len; i++) { args[i] = arguments[i]; }
1190
+ }
1191
+ return new HotObservable(this, args);
1192
+ };
1193
+
1194
+ /**
1195
+ * Creates a cold observable using the specified timestamped notification messages either as an array or arguments.
1196
+ * @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time.
1197
+ * @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications.
1198
+ */
1199
+ TestScheduler.prototype.createColdObservable = function () {
1200
+ var len = arguments.length, args;
1201
+ if (Array.isArray(arguments[0])) {
1202
+ args = arguments[0];
1203
+ } else {
1204
+ args = new Array(len);
1205
+ for (var i = 0; i < len; i++) { args[i] = arguments[i]; }
1206
+ }
1207
+ return new ColdObservable(this, args);
1208
+ };
1209
+
1210
+ /**
1211
+ * Creates a resolved promise with the given value and ticks
1212
+ * @param {Number} ticks The absolute time of the resolution.
1213
+ * @param {Any} value The value to yield at the given tick.
1214
+ * @returns {MockPromise} A mock Promise which fulfills with the given value.
1215
+ */
1216
+ TestScheduler.prototype.createResolvedPromise = function (ticks, value) {
1217
+ return new MockPromise(this, [Rx.ReactiveTest.onNext(ticks, value), Rx.ReactiveTest.onCompleted(ticks)]);
1218
+ };
1219
+
1220
+ /**
1221
+ * Creates a rejected promise with the given reason and ticks
1222
+ * @param {Number} ticks The absolute time of the resolution.
1223
+ * @param {Any} reason The reason for rejection to yield at the given tick.
1224
+ * @returns {MockPromise} A mock Promise which rejects with the given reason.
1225
+ */
1226
+ TestScheduler.prototype.createRejectedPromise = function (ticks, reason) {
1227
+ return new MockPromise(this, [Rx.ReactiveTest.onError(ticks, reason)]);
1228
+ };
1229
+
1230
+ /**
1231
+ * Creates an observer that records received notification messages and timestamps those.
1232
+ * @return Observer that can be used to assert the timing of received notifications.
1233
+ */
1234
+ TestScheduler.prototype.createObserver = function () {
1235
+ return new MockObserver(this);
1236
+ };
1237
+
1238
+ return TestScheduler;
1239
+ })(VirtualTimeScheduler);
1240
+
1241
+ return Rx;
1242
+ }));