typescript

OFF0 2 years ago
parent 838afa9ed8
commit e170570934
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -9,8 +9,8 @@ export const bounce = (
fn: () => void, fn: () => void,
time: number, time: number,
) => { ) => {
let throttle; let throttle: number | undefined;
let debounce; let debounce: number | undefined;
return (/*...args*/) => { return (/*...args*/) => {
if (throttle) { if (throttle) {
clearTimeout(debounce); clearTimeout(debounce);
@ -19,7 +19,7 @@ export const bounce = (
} }
fn(/*...args*/); fn(/*...args*/);
throttle = setTimeout(() => { throttle = setTimeout(() => {
throttle = false; clearTimeout(throttle);
}, time); }, time);
}; };
}; };

@ -1,7 +1,18 @@
{ {
"compilerOptions": { "compilerOptions": {
"alwaysStrict": true,
"moduleResolution": "node", "moduleResolution": "node",
"noImplicitAny": true,
"noImplicitThis": true,
"strictBindCallApply": true,
"strictFunctionTypes": false,
"strictNullChecks": true,
"target": "es2022" "target": "es2022"
}, },
"exclude": ["node_modules", "dist", "**/*.test.ts"] "exclude": [
"dist",
"esbuildconf.js",
"node_modules",
"**/*.test.ts"
]
} }

Loading…
Cancel
Save