typescript
parent
6e404eac6b
commit
33dd40bae5
|
@ -9,8 +9,8 @@ export const bounce = (
|
|||
fn: () => void,
|
||||
time: number,
|
||||
) => {
|
||||
let throttle;
|
||||
let debounce;
|
||||
let throttle: number | undefined;
|
||||
let debounce: number | undefined;
|
||||
return (/*...args*/) => {
|
||||
if (throttle) {
|
||||
clearTimeout(debounce);
|
||||
|
@ -19,7 +19,7 @@ export const bounce = (
|
|||
}
|
||||
fn(/*...args*/);
|
||||
throttle = setTimeout(() => {
|
||||
throttle = false;
|
||||
clearTimeout(throttle);
|
||||
}, time);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,7 +1,18 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"alwaysStrict": true,
|
||||
"moduleResolution": "node",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictBindCallApply": true,
|
||||
"strictFunctionTypes": false,
|
||||
"strictNullChecks": true,
|
||||
"target": "es2022"
|
||||
},
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
||||
"exclude": [
|
||||
"dist",
|
||||
"esbuildconf.js",
|
||||
"node_modules",
|
||||
"**/*.test.ts"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue