@instructure/debounce
Advanced tools
+2
-1
@@ -6,3 +6,3 @@ # Change Log | ||
| ## [10.4.1-snapshot-5](https://github.com/instructure/instructure-ui/compare/v10.4.0...v10.4.1-snapshot-5) (2024-10-28) | ||
| ## [10.4.1-snapshot-6](https://github.com/instructure/instructure-ui/compare/v10.4.0...v10.4.1-snapshot-6) (2024-10-28) | ||
@@ -12,2 +12,3 @@ | ||
| * docs screenreader alerts are no longer screendeader focusable ([c225853](https://github.com/instructure/instructure-ui/commit/c2258531aa377b698fe932012112704f1879b501)) | ||
| * update license ([1c039d9](https://github.com/instructure/instructure-ui/commit/1c039d9cbf5a3ea99b59803ddde5c6c0b2d76ba5)) | ||
@@ -14,0 +15,0 @@ |
+5
-2
@@ -42,2 +42,4 @@ /* | ||
| * on unmounted components. | ||
| * For a cool explanation see https://css-tricks.com/debouncing-throttling-explained-examples/ | ||
| * | ||
| * @module debounce | ||
@@ -60,3 +62,3 @@ * | ||
| let result; | ||
| let lastCallTime; // TODO this should never be undefined | ||
| let lastCallTime; | ||
| let lastInvokeTime = 0; | ||
@@ -130,3 +132,4 @@ let timers = []; | ||
| lastInvokeTime = 0; | ||
| lastArgs = lastCallTime = lastThis = void 0; | ||
| lastCallTime = 0; | ||
| lastArgs = lastThis = void 0; | ||
| } | ||
@@ -133,0 +136,0 @@ function flush() { |
+5
-2
@@ -49,2 +49,4 @@ "use strict"; | ||
| * on unmounted components. | ||
| * For a cool explanation see https://css-tricks.com/debouncing-throttling-explained-examples/ | ||
| * | ||
| * @module debounce | ||
@@ -67,3 +69,3 @@ * | ||
| let result; | ||
| let lastCallTime; // TODO this should never be undefined | ||
| let lastCallTime; | ||
| let lastInvokeTime = 0; | ||
@@ -137,3 +139,4 @@ let timers = []; | ||
| lastInvokeTime = 0; | ||
| lastArgs = lastCallTime = lastThis = void 0; | ||
| lastCallTime = 0; | ||
| lastArgs = lastThis = void 0; | ||
| } | ||
@@ -140,0 +143,0 @@ function flush() { |
+2
-2
| { | ||
| "name": "@instructure/debounce", | ||
| "version": "10.4.1-snapshot-5", | ||
| "version": "10.4.1-snapshot-6", | ||
| "description": "A debounce util made by Instructure Inc.", | ||
@@ -25,3 +25,3 @@ "author": "Instructure, Inc. Engineering and Product Design", | ||
| "devDependencies": { | ||
| "@instructure/ui-babel-preset": "10.4.1-snapshot-5" | ||
| "@instructure/ui-babel-preset": "10.4.1-snapshot-6" | ||
| }, | ||
@@ -28,0 +28,0 @@ "dependencies": { |
+14
-12
@@ -31,6 +31,5 @@ /* | ||
| export type Debounced = { | ||
| (...args: unknown[]): unknown | ||
| export type Debounced<F extends (...args: any) => any> = F & { | ||
| cancel: () => void | ||
| flush: () => void | ||
| flush: () => ReturnType<F> | ||
| } | ||
@@ -55,2 +54,4 @@ | ||
| * on unmounted components. | ||
| * For a cool explanation see https://css-tricks.com/debouncing-throttling-explained-examples/ | ||
| * | ||
| * @module debounce | ||
@@ -69,11 +70,11 @@ * | ||
| */ | ||
| function debounce( | ||
| func: (...args: any[]) => unknown, | ||
| function debounce<F extends (...args: any) => any>( | ||
| func: F, | ||
| wait = 0, | ||
| options: DebounceOptions = {} | ||
| ): Debounced { | ||
| let lastArgs: unknown[] | undefined | ||
| ) { | ||
| let lastArgs: unknown | undefined | ||
| let lastThis: unknown | ||
| let result: unknown | ||
| let lastCallTime: number | undefined // TODO this should never be undefined | ||
| let result: ReturnType<F> | ||
| let lastCallTime: number | ||
| let lastInvokeTime = 0 | ||
@@ -161,3 +162,4 @@ let timers: ReturnType<typeof setTimeout>[] = [] | ||
| lastInvokeTime = 0 | ||
| lastArgs = lastCallTime = lastThis = undefined | ||
| lastCallTime = 0 | ||
| lastArgs = lastThis = undefined | ||
| } | ||
@@ -174,3 +176,3 @@ | ||
| function debounced(...args: unknown[]) { | ||
| function debounced(...args: any[]) { | ||
| const time = Date.now() | ||
@@ -205,3 +207,3 @@ const isInvoking = shouldInvoke(time) | ||
| return debounced | ||
| return debounced as Debounced<F> | ||
| } | ||
@@ -208,0 +210,0 @@ |
@@ -6,6 +6,5 @@ interface DebounceOptions { | ||
| } | ||
| export type Debounced = { | ||
| (...args: unknown[]): unknown; | ||
| export type Debounced<F extends (...args: any) => any> = F & { | ||
| cancel: () => void; | ||
| flush: () => void; | ||
| flush: () => ReturnType<F>; | ||
| }; | ||
@@ -29,2 +28,4 @@ /** | ||
| * on unmounted components. | ||
| * For a cool explanation see https://css-tricks.com/debouncing-throttling-explained-examples/ | ||
| * | ||
| * @module debounce | ||
@@ -43,5 +44,5 @@ * | ||
| */ | ||
| declare function debounce(func: (...args: any[]) => unknown, wait?: number, options?: DebounceOptions): Debounced; | ||
| declare function debounce<F extends (...args: any) => any>(func: F, wait?: number, options?: DebounceOptions): Debounced<F>; | ||
| export default debounce; | ||
| export { debounce }; | ||
| //# sourceMappingURL=debounce.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../src/debounce.ts"],"names":[],"mappings":"AAwBA,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;IAC7B,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,iBAAS,QAAQ,CACf,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,EACjC,IAAI,SAAI,EACR,OAAO,GAAE,eAAoB,GAC5B,SAAS,CAkIX;AAED,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA"} | ||
| {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../src/debounce.ts"],"names":[],"mappings":"AAwBA,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG;IAC3D,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,KAAK,EAAE,MAAM,UAAU,CAAC,CAAC,CAAC,CAAA;CAC3B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,iBAAS,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EAC/C,IAAI,EAAE,CAAC,EACP,IAAI,SAAI,EACR,OAAO,GAAE,eAAoB,GAmIT,SAAS,CAAC,CAAC,CAAC,CACjC;AAED,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA"} |
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
147071
0.38%675
1.35%