text: /**
   * Hilo 1.1.2 for commonjs
   * Copyright 2016 alibaba.com
   * Licensed under the MIT License
   */
  var Class=require("../core/Class"),browser=require("./browser"),Ticker=Class.create({constructor:function(t){this._targetFPS=t||30,this._interval=1e3/this._targetFPS,this._tickers=[]},_paused:!1,_targetFPS:0,_interval:0,_intervalId:null,_tickers:null,_lastTime:0,_tickCount:0,_tickTime:0,_measuredFPS:0,start:function(t){if(!this._intervalId){this._lastTime=+new Date;var i,e=this,n=this._interval,s=window.requestAnimationFrame||window[browser.jsVendor+"RequestAnimationFrame"];t&&s&&n<17?(this._useRAF=!0,i=function(){e._intervalId=s(i),e._tick()}):i=function(){e._intervalId=setTimeout(i,n),e._tick()},this._paused=!1,i()}},stop:function(){if(this._useRAF){var t=window.cancelAnimationFrame||window[browser.jsVendor+"CancelAnimationFrame"];t(this._intervalId)}else clearTimeout(this._intervalId);this._intervalId=null,this._lastTime=0,this._paused=!0},pause:function(){this._paused=!0},resume:function(){this._paused=!1},_tick:function(){if(!this._paused){var t=+new Date,i=t-this._lastTime,e=this._tickers;++this._tickCount>=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var n=e.slice(0),s=0,r=n.length;s<r;s++)n[s].tick(i)}},getMeasuredFPS:function(){return Math.min(this._measuredFPS,this._targetFPS)},addTick:function(t){if(!t||"function"!=typeof t.tick)throw new Error("Ticker: The tick object must implement the tick method.");this._tickers.push(t)},removeTick:function(t){var i=this._tickers,e=i.indexOf(t);e>=0&&i.splice(e,1)},nextTick:function(t){var i=this,e={tick:function(n){i.removeTick(e),t()}};return i.addTick(e),e},timeout:function(t,i){var e=this,n=(new Date).getTime()+i,s={tick:function(){var i=(new Date).getTime(),r=i-n;r>=0&&(e.removeTick(s),t())}};return e.addTick(s),s},interval:function(t,i){var e=this,n=(new Date).getTime()+i,s={tick:function(){var e=(new Date).getTime(),s=e-n;s>=0&&(s<i&&(e-=s),n=e+i,t())}};return e.addTick(s),s}});module.exports=Ticker;