@tldraw/utils
Advanced tools
Comparing version 0.1.0-alpha.6 to 0.1.0-alpha.7
@@ -26,3 +26,3 @@ "use strict"; | ||
let state = void 0; | ||
return (...args) => { | ||
const fn = (...args) => { | ||
if (!state) { | ||
@@ -48,3 +48,9 @@ state = {}; | ||
}; | ||
fn.cancel = () => { | ||
if (!state) | ||
return; | ||
clearTimeout(state.timeout); | ||
}; | ||
return fn; | ||
} | ||
//# sourceMappingURL=debounce.js.map |
function debounce(callback, wait) { | ||
let state = void 0; | ||
return (...args) => { | ||
const fn = (...args) => { | ||
if (!state) { | ||
@@ -24,2 +24,8 @@ state = {}; | ||
}; | ||
fn.cancel = () => { | ||
if (!state) | ||
return; | ||
clearTimeout(state.timeout); | ||
}; | ||
return fn; | ||
} | ||
@@ -26,0 +32,0 @@ export { |
@@ -21,3 +21,6 @@ /* Excluded from this release type: annotateError */ | ||
*/ | ||
export declare function debounce<T extends unknown[], U>(callback: (...args: T) => PromiseLike<U> | U, wait: number): (...args: T) => Promise<U>; | ||
export declare function debounce<T extends unknown[], U>(callback: (...args: T) => PromiseLike<U> | U, wait: number): { | ||
(...args: T): Promise<U>; | ||
cancel(): void; | ||
}; | ||
@@ -24,0 +27,0 @@ /** |
@@ -5,3 +5,3 @@ { | ||
"description": "A tiny little drawing app (private utilities).", | ||
"version": "0.1.0-alpha.6", | ||
"version": "0.1.0-alpha.7", | ||
"author": "tldraw GB Ltd.", | ||
@@ -8,0 +8,0 @@ "homepage": "https://tldraw.dev", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72506
1032