@budibase/frontend-core 3.12.10 → 3.12.11
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/package.json +2 -2
- package/src/constants.ts +1 -0
- package/src/fetch/UserFetch.ts +3 -0
- package/src/utils/utils.ts +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.11",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"shortid": "2.2.15",
|
|
18
18
|
"socket.io-client": "^4.7.5"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "b5eea4bb446eb6d79440b12dfdb5c492c7ec21dc"
|
|
21
21
|
}
|
package/src/constants.ts
CHANGED
package/src/fetch/UserFetch.ts
CHANGED
package/src/utils/utils.ts
CHANGED
|
@@ -59,15 +59,19 @@ export const sequential = <
|
|
|
59
59
|
* @param minDelay the minimum delay between invocations
|
|
60
60
|
* @returns a debounced version of the callback
|
|
61
61
|
*/
|
|
62
|
-
export const debounce = (
|
|
62
|
+
export const debounce = <T extends (...args: any[]) => any>(
|
|
63
|
+
callback: T,
|
|
64
|
+
minDelay = 1000
|
|
65
|
+
) => {
|
|
63
66
|
let timeout: ReturnType<typeof setTimeout>
|
|
64
|
-
return async (...params:
|
|
67
|
+
return async (...params: Parameters<T>): Promise<ReturnType<T>> => {
|
|
65
68
|
return new Promise(resolve => {
|
|
66
69
|
if (timeout) {
|
|
67
70
|
clearTimeout(timeout)
|
|
68
71
|
}
|
|
69
72
|
timeout = setTimeout(async () => {
|
|
70
|
-
|
|
73
|
+
const result = await callback(...params)
|
|
74
|
+
resolve(result)
|
|
71
75
|
}, minDelay)
|
|
72
76
|
})
|
|
73
77
|
}
|