box-chrome-sdk
Version:
A Chrome App SDK for the Box V2 API
3 lines • 5.99 kB
JavaScript
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"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)?B(a.call(b)):j(a)?B(a):h(a)?f(a):isPromise(a)?g(a):typeof a===z?a:k(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!==z)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 w.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===z}function i(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function j(a){return a&&typeof a.next===z&&typeof a[A]===z}function k(a){return a&&a.constructor===Object}function l(a){a&&w.schedule(function(){throw a})}function m(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 n(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),u(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var d=function(a){c(m(a))};return a.attachEvent("on"+b,d),u(function(){a.detachEvent("on"+b,d)})}return a["on"+b]=c,u(function(){a["on"+b]=null})}function o(a,b,c){var d=new v;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(o(a.item(e),b,c));else a&&d.add(n(a,b,c));return d}var p=c.Observable,q=(p.prototype,p.fromPromise),r=p.throwException,s=c.AnonymousObservable,t=c.AsyncSubject,u=c.Disposable.create,v=c.CompositeDisposable,w=(c.Scheduler.immediate,c.Scheduler.timeout),x=c.helpers.isScheduler,y=Array.prototype.slice,z="function",A="throw",B=c.spawn=function(a){var b=i(a);return function(c){function e(a,b){w.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2&&(b=y.call(arguments,1)),a)try{c=h[A](a)}catch(i){return e(i)}if(!a)try{c=h.next(b)}catch(i){return e(i)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==z)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var j=!1;try{c.value.call(g,function(){j||(j=!0,f.apply(g,arguments))})}catch(i){w.schedule(function(){j||(j=!0,f.call(g,i))})}}}var g=this,h=a;if(b){var i=y.call(arguments),j=i.length,k=j&&typeof i[j-1]===z;c=k?i.pop():l,h=a.apply(this,i)}else c=c||l;f()}};c.denodify=function(a){return function(){var b,c,d,e=y.call(arguments);return e.push(function(){b=arguments,d&&!c&&(c=!0,cb.apply(this,b))}),a.apply(this,e),function(a){d=a,b&&!c&&(c=!0,a.apply(this,b))}}},p.start=function(a,b,c){return C(a,b,c)()};var C=p.toAsync=function(a,b,c){return x(c)||(c=w),function(){var d=arguments,e=new t;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()}};p.fromCallback=function(a,b,c){return function(){var d=y.call(arguments,0);return new s(function(e){function f(){var a=arguments;if(c){try{a=c(a)}catch(b){return void e.onError(b)}e.onNext(a)}else a.length<=1?e.onNext.apply(e,a):e.onNext(a);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},p.fromNodeCallback=function(a,b,c){return function(){var d=y.call(arguments,0);return new s(function(e){function f(a){if(a)return void e.onError(a);var b=y.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},c.config.useNativeEvents=!1;var D=a.angular&&angular.element?angular.element:a.jQuery?a.jQuery:a.Zepto?a.Zepto:null,E=!!a.Ember&&"function"==typeof a.Ember.addListener,F=!!a.Backbone&&!!a.Backbone.Marionette;p.fromEvent=function(a,b,d){if(a.addListener)return G(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d);if(!c.config.useNativeEvents){if(F)return G(function(c){a.on(b,c)},function(c){a.off(b,c)},d);if(E)return G(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},d);if(D){var e=D(a);return G(function(a){e.on(b,a)},function(a){e.off(b,a)},d)}}return new s(function(c){return o(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return void c.onError(e)}c.onNext(b)})}).publish().refCount()};var G=p.fromEventPattern=function(a,b,c){return new s(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return u(function(){b&&b(e,f)})}).publish().refCount()};return p.startAsync=function(a){var b;try{b=a()}catch(c){return r(c)}return q(b)},c});
//# sourceMappingURL=rx.async.compat.map