"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _toConsumableArray2=require("babel-runtime/helpers/toConsumableArray"),_toConsumableArray3=_interopRequireDefault(_toConsumableArray2);exports.default=throttleByAnimationFrame,exports.throttleByAnimationFrameDecorator=throttleByAnimationFrameDecorator;var _getRequestAnimationFrame=require("../_util/getRequestAnimationFrame"),_getRequestAnimationFrame2=_interopRequireDefault(_getRequestAnimationFrame);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var reqAnimFrame=(0,_getRequestAnimationFrame2.default)();function throttleByAnimationFrame(n){function e(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];null==a&&(a=reqAnimFrame(function(e){return function(){a=null,n.apply(void 0,(0,_toConsumableArray3.default)(e))}}(t)))}var a=void 0;return e.cancel=function(){return(0,_getRequestAnimationFrame.cancelRequestAnimationFrame)(a)},e}function throttleByAnimationFrameDecorator(){return function(t,r,e){var n=e.value,a=!1;return{configurable:!0,get:function(){if(a||this===t.prototype||this.hasOwnProperty(r))return n;var e=throttleByAnimationFrame(n.bind(this));return a=!0,Object.defineProperty(this,r,{value:e,configurable:!0,writable:!0}),a=!1,e}}}}