This repository has been archived by the owner on Apr 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
rx.jquery.min.js
1 lines (1 loc) · 5.51 KB
/
rx.jquery.min.js
1
!function(a,b){var c="object"==typeof exports&&exports&&("object"==typeof a&&a&&a==a.global&&(window=a),exports);"function"==typeof define&&define.amd?define(["rx","jquery","exports"],function(c,d,e){return a.Rx=b(a,e,c,d),a.Rx}):"object"==typeof module&&module&&module.exports==c?module.exports=b(a,module.exports,require("rx"),require("jquery")):a.Rx=b(a,{},a.Rx,jQuery)}(this,function(a,b,c,d){function e(a){return j(a).publish().refCount()}function f(a,b,c){var d=c[0];"number"==typeof d||"string"==typeof d?d={duration:d}:d||(d={}),2===c.length&&(d.easing=c[1]);var e=new i;return d.complete=function(){e.onNext(a),e.onCompleted()},a[b](d),e.asObservable()}var g=c.Observable,h=g.prototype,i=c.AsyncSubject,j=g.create,k=(g.createWithDisposable,c.Disposable.empty,Array.prototype.slice),l=d.fn;d.Deferred&&(d.Deferred.toObservable=function(a){var b=new i;return a.done(function(){b.onNext(k.call(arguments)),b.onCompleted()}).fail(function(){b.onError(k.call(arguments))}),b},h.toDeferred=function(){var a=d.Deferred();return this.subscribe(function(b){a.resolve(b)},function(b){a.reject(b)}),a}),d.Callbacks&&(d.Callbacks.prototype.toObservable=function(){var a=this;return j(function(b){function c(a){b.onNext(a)}return a.add(c),function(){a.remove(c)}})}),l.on&&(l.onAsObservable=function(){var a,b=this,c=k.call(arguments,0);return e(function(d){function e(a){a.additionalArguments=k.call(arguments,1),d.onNext(a)}return a=c.slice(),a.push(e),b.on.apply(b,a),function(){b.off.apply(b,a)}})}),l.bindAsObservable=function(a,b){var c=this;return e(function(d){function e(a){a.additionalArguments=k.call(arguments,1),d.onNext(a)}return c.bind(a,b,e),function(){c.unbind(a,b,e)}})},l.delegateAsObservable=function(a,b,c){var d=this;return e(function(e){function f(a){a.additionalArguments=k.call(arguments,1),e.onNext(a)}return d.delegate(a,b,c,f),function(){d.undelegate(a,b,f)}})},l.live&&(l.liveAsObservable=function(a,b){var c=this;return e(function(d){function e(a){a.additionalArguments=k.call(arguments,1),d.onNext(a)}return c.live(a,b,e),function(){c.die(a,b,e)}})}),l.changeAsObservable=function(a){return this.bindAsObservable("change",a)},l.clickAsObservable=function(a){return this.bindAsObservable("click",a)},l.dblclickAsObservable=function(a){return this.bindAsObservable("dblclick",a)},l.focusAsObservable=function(a){return this.bindAsObservable("focus",a)},l.focusinAsObservable=function(a){return this.bindAsObservable("focusin",a)},l.focusoutAsObservable=function(a){return this.bindAsObservable("focusout",a)},l.keypressAsObservable=function(a){return this.bindAsObservable("keypress",a)},l.keydownAsObservable=function(a){return this.bindAsObservable("keydown",a)},l.keyupAsObservable=function(a){return this.bindAsObservable("keyup",a)},l.loadAsObservable=function(a){return this.bindAsObservable("load",a)},l.mousedownAsObservable=function(a){return this.bindAsObservable("mousedown",a)},l.mouseenterAsObservable=function(a){return this.bindAsObservable("mouseenter",a)},l.mouseleaveAsObservable=function(a){return this.bindAsObservable("mouseleave",a)},l.mousemoveAsObservable=function(a){return this.bindAsObservable("mousemove",a)},l.mouseoutAsObservable=function(a){return this.bindAsObservable("mouseout",a)},l.mouseoverAsObservable=function(a){return this.bindAsObservable("mouseover",a)},l.mouseupAsObservable=function(a){return this.bindAsObservable("mouseup",a)},l.resizeAsObservable=function(a){return this.bindAsObservable("resize",a)},l.scrollAsObservable=function(a){return this.bindAsObservable("scroll",a)},l.selectAsObservable=function(a){return this.bindAsObservable("select",a)},l.submitAsObservable=function(a){return this.bindAsObservable("submit",a)},l.unloadAsObservable=function(a){return this.bindAsObservable("unload",a)},l.oneAsObservable=function(){var a,b=this,c=k.call(arguments,0);return e(function(d){function e(a){a.additionalArguments=k.call(arguments,1),d.onNext(a)}a=c.slice(),a.push(e),b.one.apply(b,a)})},l.readyAsObservable=function(){var a=this;return e(function(b){function c(a){b.onNext(a)}a.ready(c)})},l.hideAsObservable=function(){return f(this,"hide",arguments)},l.showAsObservable=function(){return f(this,"show",arguments)},l.animateAsObservable=function(a,b){"number"==typeof b||"string"==typeof b?b={duration:b}:b||(b={}),3===arguments.length&&(b.easing=arguments[2]);var c=new i;return b.complete=function(){c.onNext(this),c.onCompleted()},this.animate(a,b),c.asObservable()},l.fadeInAsObservable=function(){return f(this,"fadeIn",arguments)},l.fadeToAsObservable=function(a,b,c){var d=new i;return this.fadeTo(a,b,c,function(){d.onNext(l),d.onCompleted()}),d.asObservable()},l.fadeOutAsObservable=function(){return f(this,"fadeOut",arguments)},l.fadeToggleAsObservable=function(){return f(this,"fadeToggle",arguments)},l.slideDownAsObservable=function(){return f(this,"slideDown",arguments)},l.slideUpAsObservable=function(){return f(this,"slideUp",arguments)},l.slideToggleAsObservable=function(){return f(this,"slideToggle",arguments)},l.toggleAsObservable=function(){return f(this,"toggle",arguments)};var m=d.ajaxAsObservable=function(a){var b=new i,c={success:function(a,c,d){b.onNext({data:a,textStatus:c,jqXHR:d}),b.onCompleted()},error:function(a,c,d){b.onError({jqXHR:a,textStatus:c,errorThrown:d})}};return d.extend(!0,c,a),d.ajax(c),b};return d.getAsObservable=function(a,b,c){return m({url:a,dataType:c,data:b})},d.getJSONAsObservable=function(a,b){return m({url:a,dataType:"json",data:b})},d.getScriptAsObservable=function(a){return m({url:a,dataType:"script"})},d.postAsObservable=function(a,b,c){return m({url:a,dataType:c,data:b,type:"POST"})},c});