text: "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(source,true).forEach(function(key){(0,_defineProperty2.default)(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(source).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}}return target}var ActionWatcher=function ActionWatcher(options){var _this=this;if(options===void 0){options={onTime:{},delay:{}}}this.watch=function(e){_this._watchOnTime(e);_this._watchDelay()};this._watchOnTime=function(e){var that=_this._onTime;that.event=e;var timeout=that.timeout,onAction=that.onAction,afterAction=that.afterAction;if(e.presist)e.persist();typeof onAction==="function"&&onAction(that.event);if(that.timer){clearTimeout(that.timer);that.timer=null}that.timer=setTimeout(function(){if(typeof afterAction==="function"){afterAction(that.event);that.event=null}},timeout)};this._watchDelay=function(){var that=_this._delay;if(!that.timer){that.timer=setTimeout(function(){that.ready=true;clearTimeout(that.timer);that.timer=null},that.delay)}if(that.ready){that.ready=false;if(that.timer){clearTimeout(that.timer);that.timer=null}typeof that.afterDelay==="function"&&that.afterDelay()}};this._onTime=_objectSpread({timeout:500},options.onTime,{timer:null,event:null});this._delay=_objectSpread({delay:1e3},options.delay,{timer:null,ready:false})};module.exports=ActionWatcher;