@automerge/automerge-repo 2.1.0 → 2.2.0
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/README.md +1 -1
- package/package.json +2 -2
- package/vitest.config.ts +4 -0
- package/dist/helpers/debounce.d.ts +0 -14
- package/dist/helpers/debounce.d.ts.map +0 -1
- package/dist/helpers/debounce.js +0 -21
- package/src/helpers/debounce.ts +0 -25
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ yarn
|
|
|
125
125
|
yarn add @automerge/automerge @automerge/automerge-repo-react-hooks @automerge/automerge-repo-network-broadcastchannel @automerge/automerge-repo-storage-indexeddb vite-plugin-wasm
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
Edit the `vite.config.ts`. (This is all
|
|
128
|
+
Edit the `vite.config.ts`. (This is all needed to work around packaging hiccups due to WASM. We look
|
|
129
129
|
forward to the day that we can delete this step entirely.)
|
|
130
130
|
|
|
131
131
|
```ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automerge/automerge-repo",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "A repository object to manage a collection of automerge documents",
|
|
5
5
|
"repository": "https://github.com/automerge/automerge-repo/tree/master/packages/automerge-repo",
|
|
6
6
|
"author": "Peter van Hardenberg <pvh@pvh.ca>",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "0eab1c635365712017d7ccc000e7cd92f14e7143"
|
|
63
63
|
}
|
package/vitest.config.ts
ADDED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** throttle( callback, rate )
|
|
2
|
-
* Returns a throttle function with a build in debounce timer that runs after `wait` ms.
|
|
3
|
-
*
|
|
4
|
-
* Note that the args go inside the parameter and you should be careful not to
|
|
5
|
-
* recreate the function on each usage. (In React, see useMemo().)
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Example usage:
|
|
9
|
-
* const callback = throttle((ev) => { doSomethingExpensiveOrOccasional() }, 100)
|
|
10
|
-
* target.addEventListener('frequent-event', callback);
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
export declare const throttle: <F extends (...args: Parameters<F>) => ReturnType<F>>(fn: F, rate: number) => (...args: Parameters<F>) => void;
|
|
14
|
-
//# sourceMappingURL=debounce.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/helpers/debounce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,EAC1E,IAAI,CAAC,EACL,MAAM,MAAM,MAGK,GAAG,MAAM,UAAU,CAAC,CAAC,CAAC,SAMxC,CAAA"}
|
package/dist/helpers/debounce.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** throttle( callback, rate )
|
|
2
|
-
* Returns a throttle function with a build in debounce timer that runs after `wait` ms.
|
|
3
|
-
*
|
|
4
|
-
* Note that the args go inside the parameter and you should be careful not to
|
|
5
|
-
* recreate the function on each usage. (In React, see useMemo().)
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Example usage:
|
|
9
|
-
* const callback = throttle((ev) => { doSomethingExpensiveOrOccasional() }, 100)
|
|
10
|
-
* target.addEventListener('frequent-event', callback);
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
export const throttle = (fn, rate) => {
|
|
14
|
-
let timeout;
|
|
15
|
-
return function (...args) {
|
|
16
|
-
clearTimeout(timeout);
|
|
17
|
-
timeout = setTimeout(() => {
|
|
18
|
-
fn(...args);
|
|
19
|
-
}, rate);
|
|
20
|
-
};
|
|
21
|
-
};
|
package/src/helpers/debounce.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** throttle( callback, rate )
|
|
2
|
-
* Returns a throttle function with a build in debounce timer that runs after `wait` ms.
|
|
3
|
-
*
|
|
4
|
-
* Note that the args go inside the parameter and you should be careful not to
|
|
5
|
-
* recreate the function on each usage. (In React, see useMemo().)
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Example usage:
|
|
9
|
-
* const callback = throttle((ev) => { doSomethingExpensiveOrOccasional() }, 100)
|
|
10
|
-
* target.addEventListener('frequent-event', callback);
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export const throttle = <F extends (...args: Parameters<F>) => ReturnType<F>>(
|
|
15
|
-
fn: F,
|
|
16
|
-
rate: number
|
|
17
|
-
) => {
|
|
18
|
-
let timeout: ReturnType<typeof setTimeout>
|
|
19
|
-
return function (...args: Parameters<F>) {
|
|
20
|
-
clearTimeout(timeout)
|
|
21
|
-
timeout = setTimeout(() => {
|
|
22
|
-
fn(...args)
|
|
23
|
-
}, rate)
|
|
24
|
-
}
|
|
25
|
-
}
|