@alaarab/ogrid-js 2.0.6 → 2.0.8
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/esm/utils/debounce.js +2 -41
- package/dist/types/utils/debounce.d.ts +1 -25
- package/package.json +21 -6
|
@@ -1,41 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* milliseconds have elapsed since the last time the debounced function was invoked.
|
|
4
|
-
*
|
|
5
|
-
* @param fn - The function to debounce
|
|
6
|
-
* @param delayMs - The number of milliseconds to delay
|
|
7
|
-
* @returns A debounced version of `fn` with a `cancel()` method to abort pending invocations
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const debouncedSearch = debounce((query: string) => {
|
|
12
|
-
* console.log('Searching for:', query);
|
|
13
|
-
* }, 300);
|
|
14
|
-
*
|
|
15
|
-
* debouncedSearch('a');
|
|
16
|
-
* debouncedSearch('ab');
|
|
17
|
-
* debouncedSearch('abc'); // Only this call executes after 300ms
|
|
18
|
-
*
|
|
19
|
-
* // Cleanup when done
|
|
20
|
-
* debouncedSearch.cancel();
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export function debounce(fn, delayMs) {
|
|
24
|
-
let timeoutId = null;
|
|
25
|
-
const debounced = ((...args) => {
|
|
26
|
-
if (timeoutId !== null) {
|
|
27
|
-
clearTimeout(timeoutId);
|
|
28
|
-
}
|
|
29
|
-
timeoutId = setTimeout(() => {
|
|
30
|
-
timeoutId = null;
|
|
31
|
-
fn(...args);
|
|
32
|
-
}, delayMs);
|
|
33
|
-
});
|
|
34
|
-
debounced.cancel = () => {
|
|
35
|
-
if (timeoutId !== null) {
|
|
36
|
-
clearTimeout(timeoutId);
|
|
37
|
-
timeoutId = null;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
return debounced;
|
|
41
|
-
}
|
|
1
|
+
// Re-export from core
|
|
2
|
+
export { debounce } from '@alaarab/ogrid-core';
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Creates a debounced function that delays invoking `fn` until after `delayMs`
|
|
3
|
-
* milliseconds have elapsed since the last time the debounced function was invoked.
|
|
4
|
-
*
|
|
5
|
-
* @param fn - The function to debounce
|
|
6
|
-
* @param delayMs - The number of milliseconds to delay
|
|
7
|
-
* @returns A debounced version of `fn` with a `cancel()` method to abort pending invocations
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const debouncedSearch = debounce((query: string) => {
|
|
12
|
-
* console.log('Searching for:', query);
|
|
13
|
-
* }, 300);
|
|
14
|
-
*
|
|
15
|
-
* debouncedSearch('a');
|
|
16
|
-
* debouncedSearch('ab');
|
|
17
|
-
* debouncedSearch('abc'); // Only this call executes after 300ms
|
|
18
|
-
*
|
|
19
|
-
* // Cleanup when done
|
|
20
|
-
* debouncedSearch.cancel();
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delayMs: number): T & {
|
|
24
|
-
cancel: () => void;
|
|
25
|
-
};
|
|
1
|
+
export { debounce } from '@alaarab/ogrid-core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-js",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "OGrid vanilla JS – framework-free data grid with sorting, filtering, pagination, and spreadsheet-style editing.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -17,14 +17,29 @@
|
|
|
17
17
|
"build": "rimraf dist && tsc -p tsconfig.build.json && mkdir -p dist/styles && cp styles/ogrid.css dist/styles/ogrid.css",
|
|
18
18
|
"test": "jest"
|
|
19
19
|
},
|
|
20
|
-
"keywords": [
|
|
20
|
+
"keywords": [
|
|
21
|
+
"ogrid",
|
|
22
|
+
"datagrid",
|
|
23
|
+
"vanilla",
|
|
24
|
+
"javascript",
|
|
25
|
+
"typescript",
|
|
26
|
+
"grid"
|
|
27
|
+
],
|
|
21
28
|
"author": "Ala Arab",
|
|
22
29
|
"license": "MIT",
|
|
23
|
-
"files": [
|
|
24
|
-
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=18"
|
|
37
|
+
},
|
|
25
38
|
"dependencies": {
|
|
26
|
-
"@alaarab/ogrid-core": "2.0.
|
|
39
|
+
"@alaarab/ogrid-core": "2.0.7"
|
|
27
40
|
},
|
|
28
41
|
"sideEffects": false,
|
|
29
|
-
"publishConfig": {
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
}
|
|
30
45
|
}
|