UNPKG

box-chrome-sdk

Version:

A Chrome App SDK for the Box V2 API

1 lines 3.73 kB
(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,i=e[typeof module]&&module&&!module.nodeType&&module,o=(i&&i.exports===r&&r,e[typeof global]&&global);!o||o.global!==o&&o.window!==o||(n=o),"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(e){var n=function(){this.cancelBubble=!0},r=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(t){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(e||(e=t.event),!e.target)switch(e.target=e.target||e.srcElement,"mouseover"==e.type&&(e.relatedTarget=e.fromElement),"mouseout"==e.type&&(e.relatedTarget=e.toElement),e.stopPropagation||(e.stopPropagation=n,e.preventDefault=r),e.type){case"keypress":var i="charCode"in e?e.charCode:e.keyCode;10==i?(i=0,e.keyCode=13):13==i||27==i?i=0:3==i&&(i=99),e.charCode=i,e.keyChar=e.charCode?String.fromCharCode(e.charCode):""}return e}function i(t,e,n){if(t.addListener)return t.addListener(e,n),l(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),l(function(){t.removeEventListener(e,n,!1)});if(t.attachEvent){var i=function(t){n(r(t))};return t.attachEvent("on"+e,i),l(function(){t.detachEvent("on"+e,i)})}return t["on"+e]=n,l(function(){t["on"+e]=null})}function o(t,e,n){var r=new f;if("function"==typeof t.item&&"number"==typeof t.length)for(var s=0,u=t.length;u>s;s++)r.add(o(t.item(s),e,n));else t&&r.add(i(t,e,n));return r}var s=n.Observable,u=(s.prototype,s.fromPromise),c=s.throwException,a=n.AnonymousObservable,h=n.AsyncSubject,l=n.Disposable.create,f=n.CompositeDisposable,p=n.Scheduler.immediate,d=n.Scheduler.timeout,v=Array.prototype.slice;s.start=function(t,e,n){return b(t,e,n)()};var b=s.toAsync=function(t,e,n){return e||(e=d),function(){var r=arguments,i=new h;return e.schedule(function(){var e;try{e=t.apply(n,r)}catch(o){return i.onError(o),undefined}i.onNext(e),i.onCompleted()}),i.asObservable()}};s.fromCallback=function(t,e,n,r){return e||(e=p),function(){var i=v.call(arguments,0);return new a(function(o){return e.schedule(function(){function e(t){var e=t;if(r)try{e=r(arguments)}catch(n){return o.onError(n),undefined}else 1===e.length&&(e=e[0]);o.onNext(e),o.onCompleted()}i.push(e),t.apply(n,i)})})}},s.fromNodeCallback=function(t,e,n,r){return e||(e=p),function(){var i=v.call(arguments,0);return new a(function(o){return e.schedule(function(){function e(t){if(t)return o.onError(t),undefined;var e=v.call(arguments,1);if(r)try{e=r(e)}catch(n){return o.onError(n),undefined}else 1===e.length&&(e=e[0]);o.onNext(e),o.onCompleted()}i.push(e),t.apply(n,i)})})}};var m=t.angular&&angular.element?angular.element:t.jQuery?t.jQuery:t.Zepto?t.Zepto:null,y=!!t.Ember&&"function"==typeof t.Ember.addListener;s.fromEvent=function(t,e,n){if(y)return w(function(n){Ember.addListener(t,e,n)},function(n){Ember.removeListener(t,e,n)},n);if(m){var r=m(t);return w(function(t){r.on(e,t)},function(t){r.off(e,t)},n)}return new a(function(r){return o(t,e,function(t){var e=t;if(n)try{e=n(arguments)}catch(i){return r.onError(i),undefined}r.onNext(e)})}).publish().refCount()};var w=s.fromEventPattern=function(t,e,n){return new a(function(r){function i(t){var e=t;if(n)try{e=n(arguments)}catch(i){return r.onError(i),undefined}r.onNext(e)}var o=t(i);return l(function(){e&&e(i,o)})}).publish().refCount()};return s.startAsync=function(t){var e;try{e=t()}catch(n){return c(n)}return u(e)},n});