@taraflex/debounce
Advanced tools
+4
-3
@@ -66,6 +66,7 @@ 'use strict'; | ||
| try { | ||
| self.tm = -1; | ||
| f.apply(this, arguments); | ||
| } | ||
| finally { | ||
| self.tm = setTimeout(nullTm, self.timeout >> 0, self); | ||
| self.tm = setTimeout(nullTm, self.timeout, self); | ||
| } | ||
@@ -75,3 +76,3 @@ } | ||
| clearTimeout(self.tm); | ||
| self.tm = setTimeout(runFn, self.timeout >> 0, self, this, arguments); | ||
| self.tm = setTimeout(runFn, self.timeout, self, this, arguments); | ||
| } | ||
@@ -105,3 +106,3 @@ }) || this; | ||
| function delay(timeout) { | ||
| return new Promise(function (resolve) { return setTimeout(resolve, timeout >> 0); }); | ||
| return new Promise(function (resolve) { return setTimeout(resolve, timeout); }); | ||
| } | ||
@@ -108,0 +109,0 @@ exports.delay = delay; |
+4
-3
@@ -25,9 +25,10 @@ 'use strict'; | ||
| try { | ||
| self.tm = -1; //block runFirst | ||
| f.apply(this, arguments); | ||
| } finally { | ||
| self.tm = setTimeout(nullTm, self.timeout >> 0, self); | ||
| self.tm = setTimeout(nullTm, self.timeout, self); | ||
| } | ||
| } else { | ||
| clearTimeout(self.tm); | ||
| self.tm = setTimeout(runFn, self.timeout >> 0, self, this, arguments) | ||
| self.tm = setTimeout(runFn, self.timeout, self, this, arguments) | ||
| } | ||
@@ -65,3 +66,3 @@ }); | ||
| export function delay(timeout: number) { | ||
| return new Promise(resolve => setTimeout(resolve, timeout >> 0)); | ||
| return new Promise(resolve => setTimeout(resolve, timeout)); | ||
| } | ||
@@ -68,0 +69,0 @@ |
+1
-1
| { | ||
| "name": "@taraflex/debounce", | ||
| "version": "0.1.3", | ||
| "version": "0.1.4", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
11375
0.51%300
0.67%