🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

timeoutcontrol

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timeoutcontrol - npm Package Compare versions

Comparing version
1.1.1
to
1.1.2
+1
-1
lib/index.min.js

@@ -6,2 +6,2 @@ /*!

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).TimeoutControl=e()}(this,function(){"use strict";return function(){function t(t,e){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];var r="Failed to create TimeoutControl instance:";if(arguments.length<2)throw new TypeError(r+" at least 2 arguments required, only "+arguments.length+" supplied.");if("function"!=typeof t)throw new TypeError(r+" first argument must be a function.");if("number"!=typeof e)throw new TypeError(r+" second argument must be a number.");if(e<0)throw new RangeError(r+" second argument must be a number greater than 0.");this.params=i,this.duration=e,this.timeStart=Date.now(),this.timeStop=this.timeStart,this.callback=function(t){t.apply(void 0,this.params),this.timeStop=Date.now()}.bind(this,t),this.id=setTimeout(this.callback,this.duration)}return Object.defineProperty(t.prototype,"timeLeft",{get:function(){var t=this.duration-(this.timeStop-this.timeStart);return t<0?0:t},enumerable:!0,configurable:!0}),t.prototype.done=function(){return 0===this.timeLeft},t.prototype.pause=function(){clearTimeout(this.id),this.timeStop=Date.now()},t.prototype.resume=function(){this.id=setTimeout(this.callback,this.timeLeft)},t.prototype.clear=function(){clearTimeout(this.id),this.timeStart=Date.now(),this.timeStop=this.timeStart},t.prototype.restart=function(){this.clear(),this.id=setTimeout(this.callback,this.duration)},t}()});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).TimeoutControl=e()}(this,(function(){"use strict";var t=function(){function t(t,e){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];var r="Failed to create TimeoutControl instance:";if(arguments.length<2)throw new TypeError(r+" at least 2 arguments required, only "+arguments.length+" supplied.");if("function"!=typeof t)throw new TypeError(r+" first argument must be a function.");if("number"!=typeof e)throw new TypeError(r+" second argument must be a number.");if(e<0)throw new RangeError(r+" second argument must be a number greater than 0.");this.params=i,this.duration=e,this.timeStart=Date.now(),this.timeStop=this.timeStart,this.callback=function(t){t.apply(void 0,this.params),this.timeStop=Date.now()}.bind(this,t),this.id=setTimeout(this.callback,this.duration)}return Object.defineProperty(t.prototype,"timeLeft",{get:function(){var t=this.duration-(this.timeStop-this.timeStart);return t<0?0:t},enumerable:!0,configurable:!0}),t.prototype.done=function(){return 0===this.timeLeft},t.prototype.pause=function(){clearTimeout(this.id),this.timeStop=Date.now()},t.prototype.resume=function(){this.id=setTimeout(this.callback,this.timeLeft)},t.prototype.clear=function(){clearTimeout(this.id),this.timeStart=Date.now(),this.timeStop=this.timeStart},t.prototype.restart=function(){this.clear(),this.id=setTimeout(this.callback,this.duration)},t}();return t}));
{
"name": "timeoutcontrol",
"version": "1.1.1",
"version": "1.1.2",
"description": "A JavaScript tool to control setTimeout operations.",

@@ -24,7 +24,7 @@ "main": "./lib/index.js",

"chai": "^4.2.0",
"mocha": "^6.2.3",
"mocha": "^10.1.0",
"rollup": "^1.1.0",
"rollup-plugin-babel": "^4.3.0",
"rollup-plugin-typescript2": "^0.22.1",
"terser": "^3.14.1",
"terser": "^5.15.1",
"typescript": "^3.5.3"

@@ -31,0 +31,0 @@ },