UNPKG

@domoinc/multiline-chart

Version:

MultiLineChart - Domo Widget

6 lines (5 loc) 2.62 kB
(function(t){function y(){for(var a=0;a<h.length;a++)h[a][0](h[a][1]);h=[];m=!1}function n(a,b){h.push([a,b]);m||(m=!0,z(y,0))}function A(a,b){function c(a){p(b,a)}function e(a){k(b,a)}try{a(c,e)}catch(d){e(d)}}function q(a){var b=a.owner,c=b.state_,b=b.data_,e=a[c];a=a.then;if("function"===typeof e){c=l;try{b=e(b)}catch(d){k(a,d)}}u(a,b)||(c===l&&p(a,b),c===r&&k(a,b))}function u(a,b){var c;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(b&&("function"=== typeof b||"object"===typeof b)){var e=b.then;if("function"===typeof e)return e.call(b,function(d){c||(c=!0,b!==d?p(a,d):v(a,d))},function(b){c||(c=!0,k(a,b))}),!0}}catch(d){return c||k(a,d),!0}return!1}function p(a,b){a!==b&&u(a,b)||v(a,b)}function v(a,b){a.state_===s&&(a.state_=w,a.data_=b,n(B,a))}function k(a,b){a.state_===s&&(a.state_=w,a.data_=b,n(C,a))}function B(a){a.state_=l;a.then_=a.then_.forEach(q)}function C(a){a.state_=r;a.then_=a.then_.forEach(q)}function f(a){if("function"!==typeof a)throw new TypeError("Promise constructor takes a function argument"); if(!1===this instanceof f)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[];A(a,this)}var g=t.Promise,x=g&&"resolve"in g&&"reject"in g&&"all"in g&&"race"in g&&function(){var a;new g(function(b){a=b});return"function"===typeof a}();"undefined"!==typeof exports&&exports?exports.Promise=x?g:f:x||(t.Promise=f);var s="pending",w="sealed",l="fulfilled",r="rejected",D=function(){},z="undefined"!==typeof setImmediate? setImmediate:setTimeout,h=[],m;f.prototype={constructor:f,state_:s,then_:null,data_:void 0,then:function(a,b){var c={owner:this,then:new this.constructor(D),fulfilled:a,rejected:b};this.state_===l||this.state_===r?n(q,c):this.then_.push(c);return c.then},"catch":function(a){return this.then(null,a)}};f.all=function(a){if(!Array.isArray(a))throw new TypeError("You must pass an array to Promise.all().");return new this(function(b,c){function e(a){f++;return function(c){d[a]=c;--f||b(d)}}for(var d=[], f=0,g=0,h;g<a.length;g++)(h=a[g])&&"function"===typeof h.then?h.then(e(g),c):d[g]=h;f||b(d)})};f.race=function(a){if(!Array.isArray(a))throw new TypeError("You must pass an array to Promise.race().");return new this(function(b,c){for(var e=0,d;e<a.length;e++)(d=a[e])&&"function"===typeof d.then?d.then(b,c):b(d)})};f.resolve=function(a){return a&&"object"===typeof a&&a.constructor===this?a:new this(function(b){b(a)})};f.reject=function(a){return new this(function(b,c){c(a)})}})((new Function("return this"))());