summaryrefslogtreecommitdiffstats
path: root/js/yui3/timers/timers-min.js
blob: 379a49eb25fe4120c74a25c1df22b42401417b47 (plain)
1
2
3
4
5
6
7
8
/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/

YUI.add("timers",function(e,t){function i(e){return s}function s(e){this.capacity=this.snap(e),this.length=0,this.front=0,this.initialize()}function o(e,t,n,r,i){for(var s=0;s<i;++s)n[s+r]=e[s+t]}function u(e){return e>>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function v(){while(a.length>0){var e=a.shift();try{e.call()}catch(t){if(d)throw l(),t;setTimeout(function(){throw t},0)}}f=!1}function y(e){d&&p.domain&&(e=p.domain.bind(e)),a.push(e),f||(l(),f=!0)}function b(e){var t;return b._asynchronizer(function(){t||e()}),{cancel:function(){t=1}}}var n={},r=e.config.global;"use strict",n.exports=s,s.prototype.push=function(e){var t=this.length;this.capacity<=t&&this.grow(this.snap(this.capacity*this.growFactor));var n=this.front+t&this.capacity-1;this[n]=e,this.length=t+1},s.prototype.shift=function(){var e=this.front,t=this[e];return this[e]=void 0,this.front=e+1&this.capacity-1,this.length--,t},s.prototype.grow=function(e){var t=this.front,n=this.capacity,r=new Array(n),i=this.length;o(this,0,r,0,n),this.capacity=e,this.initialize(),this.front=0;if(t+i<=n)o(r,t,this,0,i);else{var s=i-(t+i&n-1);o(r,t,this,0,s),o(r,0,this,s,i-s)}},s.prototype.initialize=function(){var e=this.capacity;for(var t=0;t<e;++t)this[t]=void 0},s.prototype.snap=function(e){return typeof e!="number"?this.minCapacity:u(Math.min(this.maxCapacity,Math.max(this.minCapacity,e)))},s.prototype.maxCapacity=1<<30|0,s.prototype.minCapacity=16,s.prototype.growFactor=8,"use strict";var s=i("./queue"),a=new s(1024),f=!1,l=void 0,c=typeof setImmediate=="function",h,p=r.process,d=!!p&&{}.toString.call(p)==="[object process]";if(d)l=function(){var e=p.domain;e&&(h=h||(1,i)("domain"),h.active=p.domain=null),f&&c?setImmediate(v):p.nextTick(v),e&&(h.active=p.domain=e)};else if(c)l=function(){setImmediate(v)};else if(typeof MessageChannel!="undefined"){var m=new MessageChannel;m.port1.onmessage=function(){l=g,m.port1.onmessage=v,v()};var g=function(){m.port2.postMessage(0)};l=function(){setTimeout(v,0),g()}}else l=function(){setTimeout(v,0)};n.exports=y,b._asynchronizer=y,b._impl="asap",e.soon=b},"3.17.2",{requires:["yui-base"]});