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
@@ -1 +1 @@
1
- {"version":3,"file":"rx.async.compat.min.js","sources":["rx.async.compat.js"],"names":["factory","objectTypes","boolean","function","object","number","string","undefined","root","window","this","freeExports","exports","nodeType","freeModule","module","freeGlobal","global","define","amd","Rx","require","call","exp","toThunk","obj","ctx","Array","isArray","objectToThunk","isGeneratorFunction","observableSpawn","isGenerator","isObservable","observableToThunk","isPromise","promiseToThunk","fnString","isObject","done","run","fn","key","finished","results","pending","err","res","e","keys","Object","length","constructor","timeoutScheduler","schedule","i","len","observable","value","hasValue","subscribe","v","promise","then","name","next","throwString","handleError","fixEvent","event","stopPropagation","cancelBubble","preventDefault","bubbledKeyCode","keyCode","ctrlKey","defaultPrevented","returnValue","modified","target","srcElement","type","relatedTarget","fromElement","toElement","c","charCode","keyChar","String","fromCharCode","createListener","element","handler","addEventListener","disposableCreate","removeEventListener","attachEvent","innerHandler","detachEvent","createEventListener","el","eventName","disposables","CompositeDisposable","prototype","toString","add","item","Observable","observableFromPromise","fromPromise","observableThrow","throwError","AnonymousObservable","AsyncSubject","Disposable","create","Scheduler","immediate","isScheduler","slice","internals","spawn","isGenFun","exit","bind","ret","arguments","push","gen","TypeError","called","apply","args","hasCallback","pop","start","func","context","scheduler","observableToAsync","toAsync","subject","result","onError","onNext","onCompleted","asObservable","fromCallback","selector","observer","publishLast","refCount","fromNodeCallback","config","useNativeEvents","fromEvent","addListener","fromEventPattern","h","removeListener","on","off","publish","addHandler","removeHandler","startA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SAAUC,GAAKpE,EAAQkE,YAAYxD,EAAW0D,IAC9C,SAAUA,GAAKpE,EAAQqE,eAAe3D,EAAW0D,IACjDV,GAICjI,EAAGsI,OAAOC,iBAEa,kBAAfhE,GAAQsE,IAA4C,kBAAhBtE,GAAQuE,IAOlD,GAAIjD,GAAoB,SAAUqC,GACvC,MAAOnD,GACLR,EACAU,EACA,SAAkBrD,GAChB,GAAIJ,GAAUI,CAEd,IAAIqG,EACF,IACEzG,EAAUyG,EAAStB,WACnB,MAAOjF,GACP,MAAOwG,GAASN,QAAQlG,GAI5BwG,EAASL,OAAOrG,OAEnBuH,UAAUX,WAvBFM,EACL,SAAUC,GAAKpE,EAAQsE,GAAG5D,EAAW0D,IACrC,SAAUA,GAAKpE,EAAQuE,IAAI7D,EAAW0D,IACtCV,GA8BR,IAAIS,GAAmBlD,EAAWkD,iBAAmB,SAAUM,EAAYC,EAAehB,GACxF,MAAO,IAAIpC,GAAoB,SAAUqC,GACvC,QAASrD,GAAcjD,GACrB,GAAI+F,GAAS/F,CACb,IAAIqG,EACF,IACEN,EAASM,EAAStB,WAClB,MAAOjF,GACP,MAAOwG,GAASN,QAAQlG,GAG5BwG,EAASL,OAAOF,GAGlB,GAAIlE,GAAcuF,EAAWnE,EAC7B,OAAOH,GAAiB,WAClBuE,GACFA,EAAcpE,EAAcpB,OAG/BsF,UAAUX,WAkBb,OAVF5C,GAAW0D,WAAa,SAAUC,GAChC,GAAIzG,EACJ,KACEA,EAAUyG,IACV,MAAOvH,GACP,MAAO+D,GAAgB/D,GAEzB,MAAO6D,GAAsB/C,IAGtB1C"}
1
+ {"version":3,"file":"rx.async.compat.min.js","sources":["rx.async.compat.js"],"names":["factory","objectTypes","function","object","freeExports","exports","nodeType","freeSelf","self","Object","freeWindow","window","freeModule","module","freeGlobal","global","root","this","define","amd","Rx","require","call","exp","undefined","tryCatcher","tryCatchTarget","apply","arguments","e","errorObj","tryCatch","fn","isFunction","TypeError","toObservable","obj","Observable","isObservable","isPromise","fromPromise","isGeneratorFunction","isGenerator","spawn","thunkToObservable","isArrayLike","isIterable","arrayToObservable","isObject","objectToObservable","from","flatMap","toArray","defer","observable","key","results","observables","push","map","next","constructor","keys","i","len","length","forkJoin","AnonymousObservable","o","err","res","onError","args","onNext","onCompleted","throw","ctor","name","displayName","prototype","createCbObservable","ctx","selector","AsyncSubject","createCbHandler","asObservable","Array","createNodeObservable","createNodeHandler","isNodeList","el","StaticNodeList","NodeList","toString","fixEvent","event","stopPropagation","cancelBubble","preventDefault","bubbledKeyCode","keyCode","ctrlKey","defaultPrevented","returnValue","modified","target","srcElement","type","relatedTarget","fromElement","toElement","c","charCode","keyChar","String","fromCharCode","ListenDisposable","n","_e","_n","_fn","addEventListener","isDisposed","AttachEventDisposable","attachEvent","LevelOneDisposable","createListener","eventName","handler","createEventListener","disposables","CompositeDisposable","add","item","observableFromPromise","observableThrow","throwError","disposableCreate","Disposable","create","immediateScheduler","Scheduler","immediate","timeoutScheduler","isScheduler","helpers","wrap","createObservable","__generatorFunction__","gen","processGenerator","ret","done","value","g","subscribe","start","func","context","scheduler","observableToAsync","toAsync","subject","schedule","result","fromCallback","fromNodeCallback","dispose","removeEventListener","detachEvent","config","useNativeEvents","fromEvent","element","addListener","fromEventPattern","h","removeListener","on","off","publish","refCount","addHandler","removeHandler","innerHandler","startAsync","functionAsync","promise"],"mappings":";CAEE,SAAUA,GACV,GAAIC,IACFC,YAAY,EACZC,QAAU,GAIVC,EAAcH,QAAmBI,WAAYA,UAAYA,QAAQC,UAAYD,QAC7EE,EAAWN,QAAmBO,QAASA,KAAKC,QAAUD,KACtDE,EAAaT,QAAmBU,UAAWA,QAAUA,OAAOF,QAAUE,OACtEC,EAAaX,QAAmBY,UAAWA,SAAWA,OAAOP,UAAYO,OAEzEC,GADgBF,GAAcA,EAAWP,UAAYD,GAAeA,EACvDA,GAAeQ,GAA+B,gBAAVG,SAAsBA,QAAUA,OAAON,QAAUM,QAEhGC,EAAOA,EAAOF,GAAgBJ,K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WACE,GAAIvE,GAAU5B,UAAU,EACxB,OAAIK,GAAWiD,KACb1B,EAAUzB,EAASmD,GAAUvD,MAAM,KAAMC,WACrC4B,IAAY1B,GAAmBsC,EAAEG,QAAQf,EAAQ3B,OAEvDuC,GAAEK,OAAOjB,OAEZ4H,UAAUC,WAlBFN,EACL,SAAUC,GAAKH,EAAQK,GAAGnD,EAAWiD,IACrC,SAAUA,GAAKH,EAAQM,IAAIpD,EAAWiD,IACtC9F,GA0BR,IAAI6F,GAAmB1I,EAAW0I,iBAAmB,SAAUO,EAAYC,EAAerG,EAAU6E,GAElG,MADAf,GAAYe,KAAeA,EAAYnB,GAChC,GAAIzE,GAAoB,SAAUC,GACvC,QAASoH,KACP,GAAIpB,GAASxI,UAAU,EACvB,OAAIK,GAAWiD,KACbkF,EAASrI,EAASmD,GAAUvD,MAAM,KAAMC,WACpCwI,IAAWtI,GAAmBsC,EAAEG,QAAQ6F,EAAOvI,OAErDuC,GAAEK,OAAO2F,GAGX,GAAI7D,GAAc+E,EAAWE,EAC7B,OAAO/C,GAAiB,WACtBxG,EAAWsJ,IAAkBA,EAAcC,EAAcjF,OAE1D6E,UAAUC,WAkBf,OAVAhJ,GAAWoJ,WAAa,SAAUC,GAChC,GAAIC,EACJ,KACEA,EAAUD,IACV,MAAO7J,GACP,MAAO0G,GAAgB1G,GAEzB,MAAOyG,GAAsBqD,IAGxBvK"}
@@ -1,3 +1,3 @@
1
1
  /* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
2
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return Array.isArray(a)?e.call(b,a):i(a)?A(a.call(b)):j(a)?A(a):h(a)?f(a):isPromise(a)?g(a):typeof a===x?a:z(a)||Array.isArray(a)?e.call(b,a):a}function e(a){var b=this;return function(c){function e(a,e){if(!f)try{if(a=d(a,b),typeof a!==x)return i[e]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[e]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void v.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)e(a[g[j]],g[j])}}function f(a){return function(b){var c,d=!1;a.subscribe(function(a){c=a,d=!0},b,function(){d&&b(null,c)})}}function g(a){return function(b){a.then(function(a){b(null,a)},b)}}function h(a){return a&&typeof a.subscribe===x}function i(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function j(a){return a&&typeof a.next===x&&typeof a[y]===x}function k(a){a&&v.schedule(function(){throw a})}function l(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 m(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),t(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var d=function(a){c(l(a))};return a.attachEvent("on"+b,d),t(function(){a.detachEvent("on"+b,d)})}return a["on"+b]=c,t(function(){a["on"+b]=null})}function n(a,b,c){var d=new u;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(n(a.item(e),b,c));else a&&d.add(m(a,b,c));return d}var o=c.Observable,p=(o.prototype,o.fromPromise),q=o.throwError,r=c.AnonymousObservable,s=c.AsyncSubject,t=c.Disposable.create,u=c.CompositeDisposable,v=(c.Scheduler.immediate,c.Scheduler["default"]),w=c.Scheduler.isScheduler,x=(Array.prototype.slice,"function"),y="throw",z=c.internals.isObject,A=c.spawn=function(a){var b=i(a);return function(c){function e(a,b){v.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2)for(var b=[],i=1,j=arguments.length;j>i;i++)b.push(arguments[i]);if(a)try{c=h[y](a)}catch(k){return e(k)}if(!a)try{c=h.next(b)}catch(k){return e(k)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==x)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var l=!1;try{c.value.call(g,function(){l||(l=!0,f.apply(g,arguments))})}catch(k){v.schedule(function(){l||(l=!0,f.call(g,k))})}}}var g=this,h=a;if(b){for(var i=[],j=0,l=arguments.length;l>j;j++)i.push(arguments[j]);var l=i.length,m=l&&typeof i[l-1]===x;c=m?i.pop():k,h=a.apply(this,i)}else c=c||k;f()}};o.start=function(a,b,c){return B(a,b,c)()};var B=o.toAsync=function(a,b,c){return w(c)||(c=v),function(){var d=arguments,e=new s;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()}};o.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 new r(function(d){function f(){for(var a=arguments.length,e=new Array(a),f=0;a>f;f++)e[f]=arguments[f];if(c){try{e=c.apply(b,e)}catch(g){return d.onError(g)}d.onNext(e)}else e.length<=1?d.onNext.apply(d,e):d.onNext(e);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},o.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 new r(function(d){function f(a){if(a)return void d.onError(a);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(c){try{f=c.apply(b,f)}catch(h){return d.onError(h)}d.onNext(f)}else f.length<=1?d.onNext.apply(d,f):d.onNext(f);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},c.config.useNativeEvents=!1,o.fromEvent=function(a,b,d){return a.addListener?C(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 r(function(c){return n(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return c.onError(e)}c.onNext(b)})}).publish().refCount():C(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var C=o.fromEventPattern=function(a,b,c){return new r(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e)}d.onNext(b)}var f=a(e);return t(function(){b&&b(e,f)})}).publish().refCount()};return o.startAsync=function(a){var b;try{b=a()}catch(c){return q(c)}return p(b)},c});
2
+ (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 a.onNext(e.length<=1?e[0]: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 a.onNext(g.length<=1?g[0]: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:{}};y.wrap=function(a){function b(){return y.spawn.call(this,a.apply(this,arguments))}return b.__generatorFunction__=a,b};var L=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});
3
3
  //# sourceMappingURL=rx.async.compat.map
@@ -1,36 +1,32 @@
1
1
  // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
2
 
3
3
  ;(function (factory) {
4
- var objectTypes = {
5
- 'boolean': false,
6
- 'function': true,
7
- 'object': true,
8
- 'number': false,
9
- 'string': false,
10
- 'undefined': false
11
- };
12
-
13
- var root = (objectTypes[typeof window] && window) || this,
14
- freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
15
- freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
16
- moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
17
- freeGlobal = objectTypes[typeof global] && global;
18
-
19
- if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
20
- root = freeGlobal;
21
- }
4
+ var objectTypes = {
5
+ 'function': true,
6
+ 'object': true
7
+ };
22
8
 
23
- // Because of build optimizers
24
- if (typeof define === 'function' && define.amd) {
25
- define(['rx.binding', 'exports'], function (Rx, exports) {
26
- root.Rx = factory(root, exports, Rx);
27
- return root.Rx;
28
- });
29
- } else if (typeof module === 'object' && module && module.exports === freeExports) {
30
- module.exports = factory(root, module.exports, require('./rx'));
31
- } else {
32
- root.Rx = factory(root, {}, root.Rx);
33
- }
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.binding', 'exports'], function (Rx, exports) {
22
+ root.Rx = factory(root, exports, Rx);
23
+ return root.Rx;
24
+ });
25
+ } else if (typeof module === 'object' && module && module.exports === freeExports) {
26
+ module.exports = factory(root, module.exports, require('./rx'));
27
+ } else {
28
+ root.Rx = factory(root, {}, root.Rx);
29
+ }
34
30
  }.call(this, function (root, exp, Rx, undefined) {
35
31
 
36
32
  // Aliases
@@ -45,201 +41,152 @@
45
41
  immediateScheduler = Rx.Scheduler.immediate,
46
42
  timeoutScheduler = Rx.Scheduler['default'],
47
43
  isScheduler = Rx.Scheduler.isScheduler,
48
- slice = Array.prototype.slice;
49
-
50
- var fnString = 'function',
51
- throwString = 'throw',
52
- isObject = Rx.internals.isObject;
53
-
54
- function toThunk(obj, ctx) {
55
- if (Array.isArray(obj)) { return objectToThunk.call(ctx, obj); }
56
- if (isGeneratorFunction(obj)) { return observableSpawn(obj.call(ctx)); }
57
- if (isGenerator(obj)) { return observableSpawn(obj); }
58
- if (isObservable(obj)) { return observableToThunk(obj); }
59
- if (isPromise(obj)) { return promiseToThunk(obj); }
60
- if (typeof obj === fnString) { return obj; }
61
- if (isObject(obj) || Array.isArray(obj)) { return objectToThunk.call(ctx, obj); }
62
-
63
- return obj;
64
- }
65
-
66
- function objectToThunk(obj) {
67
- var ctx = this;
68
-
69
- return function (done) {
70
- var keys = Object.keys(obj),
71
- pending = keys.length,
72
- results = new obj.constructor(),
73
- finished;
74
-
75
- if (!pending) {
76
- timeoutScheduler.schedule(function () { done(null, results); });
77
- return;
78
- }
79
-
80
- for (var i = 0, len = keys.length; i < len; i++) {
81
- run(obj[keys[i]], keys[i]);
82
- }
83
-
84
- function run(fn, key) {
85
- if (finished) { return; }
86
- try {
87
- fn = toThunk(fn, ctx);
88
-
89
- if (typeof fn !== fnString) {
90
- results[key] = fn;
91
- return --pending || done(null, results);
92
- }
93
-
94
- fn.call(ctx, function(err, res) {
95
- if (finished) { return; }
96
-
97
- if (err) {
98
- finished = true;
99
- return done(err);
100
- }
101
-
102
- results[key] = res;
103
- --pending || done(null, results);
104
- });
105
- } catch (e) {
106
- finished = true;
107
- done(e);
108
- }
109
- }
110
- }
111
- }
44
+ isPromise = Rx.helpers.isPromise,
45
+ isFunction = Rx.helpers.isFunction;
112
46
 
113
- function observableToThunk(observable) {
114
- return function (fn) {
115
- var value, hasValue = false;
116
- observable.subscribe(
117
- function (v) {
118
- value = v;
119
- hasValue = true;
120
- },
121
- fn,
122
- function () {
123
- hasValue && fn(null, value);
124
- });
47
+ var errorObj = {e: {}};
48
+ var tryCatchTarget;
49
+ function tryCatcher() {
50
+ try {
51
+ return tryCatchTarget.apply(this, arguments);
52
+ } catch (e) {
53
+ errorObj.e = e;
54
+ return errorObj;
125
55
  }
126
56
  }
127
-
128
- function promiseToThunk(promise) {
129
- return function(fn) {
130
- promise.then(function(res) {
131
- fn(null, res);
132
- }, fn);
133
- }
57
+ function tryCatch(fn) {
58
+ if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
59
+ tryCatchTarget = fn;
60
+ return tryCatcher;
134
61
  }
135
-
136
- function isObservable(obj) {
137
- return obj && typeof obj.subscribe === fnString;
62
+ function thrower(e) {
63
+ throw e;
138
64
  }
139
65
 
140
- function isGeneratorFunction(obj) {
141
- return obj && obj.constructor && obj.constructor.name === 'GeneratorFunction';
142
- }
66
+ Observable.wrap = function (fn) {
67
+ createObservable.__generatorFunction__ = fn;
68
+ return createObservable;
143
69
 
144
- function isGenerator(obj) {
145
- return obj && typeof obj.next === fnString && typeof obj[throwString] === fnString;
146
- }
147
-
148
- /*
149
- * Spawns a generator function which allows for Promises, Observable sequences, Arrays, Objects, Generators and functions.
150
- * @param {Function} The spawning function.
151
- * @returns {Function} a function which has a done continuation.
152
- */
153
- var observableSpawn = Rx.spawn = function (fn) {
154
- var isGenFun = isGeneratorFunction(fn);
70
+ function createObservable() {
71
+ return Observable.spawn.call(this, fn.apply(this, arguments));
72
+ }
73
+ };
155
74
 
156
- return function (done) {
157
- var ctx = this,
158
- gen = fn;
75
+ var spawn = Observable.spawn = function () {
76
+ var gen = arguments[0], self = this, args = [];
77
+ for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
159
78
 
160
- if (isGenFun) {
161
- for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
162
- var len = args.length,
163
- hasCallback = len && typeof args[len - 1] === fnString;
79
+ return new AnonymousObservable(function (o) {
80
+ var g = new CompositeDisposable();
164
81
 
165
- done = hasCallback ? args.pop() : handleError;
166
- gen = fn.apply(this, args);
167
- } else {
168
- done = done || handleError;
82
+ if (isFunction(gen)) { gen = gen.apply(self, args); }
83
+ if (!gen || !isFunction(gen.next)) {
84
+ o.onNext(gen);
85
+ return o.onCompleted();
169
86
  }
170
87
 
171
- next();
88
+ processGenerator();
172
89
 
173
- function exit(err, res) {
174
- timeoutScheduler.schedule(done.bind(ctx, err, res));
90
+ function processGenerator(res) {
91
+ var ret = tryCatch(gen.next).call(gen, res);
92
+ if (ret === errorObj) { return o.onError(ret.e); }
93
+ next(ret);
175
94
  }
176
95
 
177
- function next(err, res) {
178
- var ret;
96
+ function onError(err) {
97
+ var ret = tryCatch(gen.next).call(gen, err);
98
+ if (ret === errorObj) { return o.onError(ret.e); }
99
+ next(ret);
100
+ }
179
101
 
180
- // multiple args
181
- if (arguments.length > 2) {
182
- for(var res = [], i = 1, len = arguments.length; i < len; i++) { res.push(arguments[i]); }
102
+ function next(ret) {
103
+ if (ret.done) {
104
+ o.onNext(ret.value);
105
+ o.onCompleted();
106
+ return;
183
107
  }
184
-
185
- if (err) {
186
- try {
187
- ret = gen[throwString](err);
188
- } catch (e) {
189
- return exit(e);
190
- }
108
+ var value = toObservable.call(self, ret.value);
109
+ if (Observable.isObservable(value)) {
110
+ g.add(value.subscribe(processGenerator, onError));
111
+ } else {
112
+ onError(new TypeError('type not supported'));
191
113
  }
114
+ }
192
115
 
193
- if (!err) {
194
- try {
195
- ret = gen.next(res);
196
- } catch (e) {
197
- return exit(e);
198
- }
199
- }
116
+ return g;
117
+ });
118
+ }
200
119
 
201
- if (ret.done) {
202
- return exit(null, ret.value);
203
- }
120
+ function toObservable(obj) {
121
+ if (!obj) { return obj; }
122
+ if (Observable.isObservable(obj)) { return obj; }
123
+ if (isPromise(obj)) { return Observable.fromPromise(obj); }
124
+ if (isGeneratorFunction(obj) || isGenerator(obj)) { return spawn.call(this, obj); }
125
+ if (isFunction(obj)) { return thunkToObservable.call(this, obj); }
126
+ if (isArrayLike(obj) || isIterable(obj)) { return arrayToObservable.call(this, obj); }
127
+ if (isObject(obj)) {return objectToObservable.call(this, obj);}
128
+ return obj;
129
+ }
130
+
131
+ function arrayToObservable (obj) {
132
+ return Observable.from(obj)
133
+ .flatMap(toObservable)
134
+ .toArray();
135
+ }
136
+
137
+ function objectToObservable (obj) {
138
+ var results = new obj.constructor(), keys = Object.keys(obj), observables = [];
139
+ for (var i = 0, len = keys.length; i < len; i++) {
140
+ var key = keys[i];
141
+ var observable = toObservable.call(this, obj[key]);
142
+
143
+ if(observable && Observable.isObservable(observable)) {
144
+ defer(observable, key);
145
+ } else {
146
+ results[key] = obj[key];
147
+ }
148
+ }
204
149
 
205
- ret.value = toThunk(ret.value, ctx);
206
-
207
- if (typeof ret.value === fnString) {
208
- var called = false;
209
- try {
210
- ret.value.call(ctx, function() {
211
- if (called) {
212
- return;
213
- }
214
-
215
- called = true;
216
- next.apply(ctx, arguments);
217
- });
218
- } catch (e) {
219
- timeoutScheduler.schedule(function () {
220
- if (called) {
221
- return;
222
- }
223
-
224
- called = true;
225
- next.call(ctx, e);
226
- });
227
- }
228
- return;
229
- }
150
+ return Observable.forkJoin.apply(Observable, observables).map(function() {
151
+ return results;
152
+ });
230
153
 
231
- // Not supported
232
- next(new TypeError('Rx.spawn only supports a function, Promise, Observable, Object or Array.'));
233
- }
234
- }
235
- };
236
154
 
237
- function handleError(err) {
238
- if (!err) { return; }
239
- timeoutScheduler.schedule(function() {
240
- throw err;
241
- });
155
+ function defer (observable, key) {
156
+ results[key] = undefined;
157
+ observables.push(observable.map(function (next) {
158
+ results[key] = next;
159
+ }));
242
160
  }
161
+ }
162
+
163
+ function thunkToObservable(fn) {
164
+ var self = this;
165
+ return new AnonymousObservable(function (o) {
166
+ fn.call(self, function () {
167
+ var err = arguments[0], res = arguments[1];
168
+ if (err) { return o.onError(err); }
169
+ if (arguments.length > 2) {
170
+ var args = [];
171
+ for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
172
+ res = args;
173
+ }
174
+ o.onNext(res);
175
+ o.onCompleted();
176
+ });
177
+ });
178
+ }
179
+
180
+ function isGenerator(obj) {
181
+ return isFunction (obj.next) && isFunction (obj.throw);
182
+ }
183
+
184
+ function isGeneratorFunction(obj) {
185
+ var ctor = obj.constructor;
186
+ if (!ctor) { return false; }
187
+ if (ctor.name === 'GeneratorFunction' || ctor.displayName === 'GeneratorFunction') { return true; }
188
+ return isGenerator(ctor.prototype);
189
+ }
243
190
 
244
191
  /**
245
192
  * Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
@@ -290,115 +237,128 @@
290
237
  };
291
238
  };
292
239
 
293
- /**
294
- * Converts a callback function to an observable sequence.
295
- *
296
- * @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
297
- * @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
298
- * @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
299
- * @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.
300
- */
301
- Observable.fromCallback = function (func, context, selector) {
302
- return function () {
303
- var len = arguments.length, args = new Array(len)
304
- for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
305
-
306
- return new AnonymousObservable(function (observer) {
307
- function handler() {
308
- var len = arguments.length, results = new Array(len);
309
- for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
310
-
311
- if (selector) {
312
- try {
313
- results = selector.apply(context, results);
314
- } catch (e) {
315
- return observer.onError(e);
316
- }
317
-
318
- observer.onNext(results);
319
- } else {
320
- if (results.length <= 1) {
321
- observer.onNext.apply(observer, results);
322
- } else {
323
- observer.onNext(results);
324
- }
325
- }
326
-
327
- observer.onCompleted();
328
- }
240
+ function createCbObservable(fn, ctx, selector, args) {
241
+ var o = new AsyncSubject();
329
242
 
330
- args.push(handler);
331
- func.apply(context, args);
332
- }).publishLast().refCount();
333
- };
334
- };
243
+ args.push(createCbHandler(o, ctx, selector));
244
+ fn.apply(ctx, args);
335
245
 
336
- /**
337
- * Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
338
- * @param {Function} func The function to call
339
- * @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
340
- * @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
341
- * @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
342
- */
343
- Observable.fromNodeCallback = function (func, context, selector) {
344
- return function () {
345
- var len = arguments.length, args = new Array(len);
346
- for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
347
-
348
- return new AnonymousObservable(function (observer) {
349
- function handler(err) {
350
- if (err) {
351
- observer.onError(err);
352
- return;
353
- }
354
-
355
- var len = arguments.length, results = [];
356
- for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }
357
-
358
- if (selector) {
359
- try {
360
- results = selector.apply(context, results);
361
- } catch (e) {
362
- return observer.onError(e);
363
- }
364
- observer.onNext(results);
365
- } else {
366
- if (results.length <= 1) {
367
- observer.onNext.apply(observer, results);
368
- } else {
369
- observer.onNext(results);
370
- }
371
- }
372
-
373
- observer.onCompleted();
374
- }
246
+ return o.asObservable();
247
+ }
375
248
 
376
- args.push(handler);
377
- func.apply(context, args);
378
- }).publishLast().refCount();
379
- };
249
+ function createCbHandler(o, ctx, selector) {
250
+ return function handler () {
251
+ var len = arguments.length, results = new Array(len);
252
+ for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
253
+
254
+ if (isFunction(selector)) {
255
+ results = tryCatch(selector).apply(ctx, results);
256
+ if (results === errorObj) { return o.onError(results.e); }
257
+ o.onNext(results);
258
+ } else {
259
+ if (results.length <= 1) {
260
+ o.onNext(results[0]);
261
+ } else {
262
+ o.onNext(results);
263
+ }
264
+ }
265
+
266
+ o.onCompleted();
267
+ };
268
+ }
269
+
270
+ /**
271
+ * Converts a callback function to an observable sequence.
272
+ *
273
+ * @param {Function} fn Function with a callback as the last parameter to convert to an Observable sequence.
274
+ * @param {Mixed} [ctx] The context for the func parameter to be executed. If not specified, defaults to undefined.
275
+ * @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
276
+ * @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.
277
+ */
278
+ Observable.fromCallback = function (fn, ctx, selector) {
279
+ return function () {
280
+ typeof ctx === 'undefined' && (ctx = this);
281
+
282
+ var len = arguments.length, args = new Array(len)
283
+ for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
284
+ return createCbObservable(fn, ctx, selector, args);
380
285
  };
286
+ };
381
287
 
382
- function createListener (element, name, handler) {
383
- if (element.addEventListener) {
384
- element.addEventListener(name, handler, false);
385
- return disposableCreate(function () {
386
- element.removeEventListener(name, handler, false);
387
- });
288
+ function createNodeObservable(fn, ctx, selector, args) {
289
+ var o = new AsyncSubject();
290
+
291
+ args.push(createNodeHandler(o, ctx, selector));
292
+ fn.apply(ctx, args);
293
+
294
+ return o.asObservable();
295
+ }
296
+
297
+ function createNodeHandler(o, ctx, selector) {
298
+ return function handler () {
299
+ var err = arguments[0];
300
+ if (err) { return o.onError(err); }
301
+
302
+ var len = arguments.length, results = [];
303
+ for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }
304
+
305
+ if (isFunction(selector)) {
306
+ var results = tryCatch(selector).apply(ctx, results);
307
+ if (results === errorObj) { return o.onError(results.e); }
308
+ o.onNext(results);
309
+ } else {
310
+ if (results.length <= 1) {
311
+ o.onNext(results[0]);
312
+ } else {
313
+ o.onNext(results);
314
+ }
388
315
  }
389
- throw new Error('No listener found');
316
+
317
+ o.onCompleted();
318
+ };
319
+ }
320
+
321
+ /**
322
+ * Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
323
+ * @param {Function} fn The function to call
324
+ * @param {Mixed} [ctx] The context for the func parameter to be executed. If not specified, defaults to undefined.
325
+ * @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
326
+ * @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
327
+ */
328
+ Observable.fromNodeCallback = function (fn, ctx, selector) {
329
+ return function () {
330
+ typeof ctx === 'undefined' && (ctx = this);
331
+ var len = arguments.length, args = new Array(len);
332
+ for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
333
+ return createNodeObservable(fn, ctx, selector, args);
334
+ };
335
+ };
336
+
337
+ function ListenDisposable(e, n, fn) {
338
+ this._e = e;
339
+ this._n = n;
340
+ this._fn = fn;
341
+ this._e.addEventListener(this._n, this._fn, false);
342
+ this.isDisposed = false;
390
343
  }
344
+ ListenDisposable.prototype.dispose = function () {
345
+ if (!this.isDisposed) {
346
+ this._e.removeEventListener(this._n, this._fn, false);
347
+ this.isDisposed = true;
348
+ }
349
+ };
391
350
 
392
351
  function createEventListener (el, eventName, handler) {
393
352
  var disposables = new CompositeDisposable();
394
353
 
395
- // Asume NodeList
396
- if (Object.prototype.toString.call(el) === '[object NodeList]') {
354
+ // Asume NodeList or HTMLCollection
355
+ var elemToString = Object.prototype.toString.call(el);
356
+ if (elemToString === '[object NodeList]' || elemToString === '[object HTMLCollection]') {
397
357
  for (var i = 0, len = el.length; i < len; i++) {
398
358
  disposables.add(createEventListener(el.item(i), eventName, handler));
399
359
  }
400
360
  } else if (el) {
401
- disposables.add(createListener(el, eventName, handler));
361
+ disposables.add(new ListenDisposable(el, eventName, handler));
402
362
  }
403
363
 
404
364
  return disposables;
@@ -409,12 +369,19 @@
409
369
  */
410
370
  Rx.config.useNativeEvents = false;
411
371
 
372
+ function eventHandler(o, selector) {
373
+ return function handler () {
374
+ var results = arguments[0];
375
+ if (isFunction(selector)) {
376
+ results = tryCatch(selector).apply(null, arguments);
377
+ if (results === errorObj) { return o.onError(results.e); }
378
+ }
379
+ o.onNext(results);
380
+ };
381
+ }
382
+
412
383
  /**
413
384
  * Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
414
- *
415
- * @example
416
- * var source = Rx.Observable.fromEvent(element, 'mouseup');
417
- *
418
385
  * @param {Object} element The DOMElement or NodeList to attach a listener.
419
386
  * @param {String} eventName The event name to attach the observable sequence.
420
387
  * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
@@ -439,23 +406,12 @@
439
406
  selector);
440
407
  }
441
408
  }
442
- return new AnonymousObservable(function (observer) {
409
+
410
+ return new AnonymousObservable(function (o) {
443
411
  return createEventListener(
444
412
  element,
445
413
  eventName,
446
- function handler (e) {
447
- var results = e;
448
-
449
- if (selector) {
450
- try {
451
- results = selector(arguments);
452
- } catch (err) {
453
- return observer.onError(err);
454
- }
455
- }
456
-
457
- observer.onNext(results);
458
- });
414
+ eventHandler(o, selector));
459
415
  }).publish().refCount();
460
416
  };
461
417
 
@@ -464,27 +420,24 @@
464
420
  * @param {Function} addHandler The function to add a handler to the emitter.
465
421
  * @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
466
422
  * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
423
+ * @param {Scheduler} [scheduler] A scheduler used to schedule the remove handler.
467
424
  * @returns {Observable} An observable sequence which wraps an event from an event emitter
468
425
  */
469
- var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
470
- return new AnonymousObservable(function (observer) {
471
- function innerHandler (e) {
472
- var result = e;
473
- if (selector) {
474
- try {
475
- result = selector(arguments);
476
- } catch (err) {
477
- return observer.onError(err);
478
- }
426
+ var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector, scheduler) {
427
+ isScheduler(scheduler) || (scheduler = immediateScheduler);
428
+ return new AnonymousObservable(function (o) {
429
+ function innerHandler () {
430
+ var result = arguments[0];
431
+ if (isFunction(selector)) {
432
+ result = tryCatch(selector).apply(null, arguments);
433
+ if (result === errorObj) { return o.onError(result.e); }
479
434
  }
480
- observer.onNext(result);
435
+ o.onNext(result);
481
436
  }
482
437
 
483
438
  var returnValue = addHandler(innerHandler);
484
439
  return disposableCreate(function () {
485
- if (removeHandler) {
486
- removeHandler(innerHandler, returnValue);
487
- }
440
+ isFunction(removeHandler) && removeHandler(innerHandler, returnValue);
488
441
  });
489
442
  }).publish().refCount();
490
443
  };
@@ -504,5 +457,5 @@
504
457
  return observableFromPromise(promise);
505
458
  }
506
459
 
507
- return Rx;
460
+ return Rx;
508
461
  }));