@libp2p/utils 6.1.3-c2ff2e454 → 6.1.3-d30d07e6f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/debounce.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Startable } from '@libp2p/interface';
|
|
2
|
+
export interface DebouncedFunction extends Startable {
|
|
2
3
|
(): void;
|
|
3
|
-
stop(): void;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Returns a function wrapper that will only call the passed function once
|
|
7
7
|
*
|
|
8
8
|
* Important - the passed function should not throw or reject
|
|
9
9
|
*/
|
|
10
|
-
export declare function debounce(func: () => void | Promise<void>, wait: number):
|
|
10
|
+
export declare function debounce(func: () => void | Promise<void>, wait: number): DebouncedFunction;
|
|
11
11
|
//# sourceMappingURL=debounce.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/debounce.ts"],"names":[],"mappings":"AAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/debounce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,IAAI,IAAI,CAAA;CACT;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAE,IAAI,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAkB3F"}
|
package/dist/src/debounce.js
CHANGED
package/dist/src/debounce.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/debounce.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/debounce.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAE,IAAgC,EAAE,IAAY;IACtE,IAAI,OAAkD,CAAA;IAEtD,MAAM,MAAM,GAAG;QACb,MAAM,KAAK,GAAG;YACZ,OAAO,GAAG,SAAS,CAAA;YACnB,KAAK,IAAI,EAAE,CAAA;QACb,CAAC,CAAA;QAED,YAAY,CAAC,OAAO,CAAC,CAAA;QACrB,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC,CAAA;IACD,MAAM,CAAC,KAAK,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;IACvB,MAAM,CAAC,IAAI,GAAG,GAAG,EAAE;QACjB,YAAY,CAAC,OAAO,CAAC,CAAA;IACvB,CAAC,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/utils",
|
|
3
|
-
"version": "6.1.3-
|
|
3
|
+
"version": "6.1.3-d30d07e6f",
|
|
4
4
|
"description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/utils#readme",
|
|
@@ -156,9 +156,9 @@
|
|
|
156
156
|
},
|
|
157
157
|
"dependencies": {
|
|
158
158
|
"@chainsafe/is-ip": "^2.0.2",
|
|
159
|
-
"@libp2p/crypto": "5.0.6-
|
|
160
|
-
"@libp2p/interface": "2.2.0-
|
|
161
|
-
"@libp2p/logger": "5.1.3-
|
|
159
|
+
"@libp2p/crypto": "5.0.6-d30d07e6f",
|
|
160
|
+
"@libp2p/interface": "2.2.0-d30d07e6f",
|
|
161
|
+
"@libp2p/logger": "5.1.3-d30d07e6f",
|
|
162
162
|
"@multiformats/multiaddr": "^12.2.3",
|
|
163
163
|
"@sindresorhus/fnv1a": "^3.1.0",
|
|
164
164
|
"@types/murmurhash3js-revisited": "^3.0.3",
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"uint8arrays": "^5.1.0"
|
|
180
180
|
},
|
|
181
181
|
"devDependencies": {
|
|
182
|
-
"@libp2p/peer-id": "5.0.7-
|
|
182
|
+
"@libp2p/peer-id": "5.0.7-d30d07e6f",
|
|
183
183
|
"@types/netmask": "^2.0.5",
|
|
184
184
|
"aegir": "^44.0.1",
|
|
185
185
|
"benchmark": "^2.1.4",
|
package/src/debounce.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Startable } from '@libp2p/interface'
|
|
2
|
+
|
|
3
|
+
export interface DebouncedFunction extends Startable {
|
|
2
4
|
(): void
|
|
3
|
-
stop(): void
|
|
4
5
|
}
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -8,7 +9,7 @@ export interface CancelableFunction {
|
|
|
8
9
|
*
|
|
9
10
|
* Important - the passed function should not throw or reject
|
|
10
11
|
*/
|
|
11
|
-
export function debounce (func: () => void | Promise<void>, wait: number):
|
|
12
|
+
export function debounce (func: () => void | Promise<void>, wait: number): DebouncedFunction {
|
|
12
13
|
let timeout: ReturnType<typeof setTimeout> | undefined
|
|
13
14
|
|
|
14
15
|
const output = function (): void {
|
|
@@ -20,6 +21,7 @@ export function debounce (func: () => void | Promise<void>, wait: number): Cance
|
|
|
20
21
|
clearTimeout(timeout)
|
|
21
22
|
timeout = setTimeout(later, wait)
|
|
22
23
|
}
|
|
24
|
+
output.start = () => {}
|
|
23
25
|
output.stop = () => {
|
|
24
26
|
clearTimeout(timeout)
|
|
25
27
|
}
|