Skip to content

Commit

Permalink
Capture args in outer scope
Browse files Browse the repository at this point in the history
  • Loading branch information
etimberg committed Dec 6, 2022
1 parent 5a50529 commit 521b7ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/helpers/helpers.extras.ts
Expand Up @@ -27,11 +27,12 @@ export function throttled<TArgs extends Array<any>>(
fn: (...args: TArgs) => void,
thisArg: any,
) {
let argsToUse = [] as TArgs;
let ticking = false;

return function(...args: TArgs) {
// Save the args for use later
const argsToUse = Array.from(args) as TArgs;
argsToUse = Array.from(args) as TArgs;
if (!ticking) {
ticking = true;
requestAnimFrame.call(window, () => {
Expand Down

0 comments on commit 521b7ef

Please sign in to comment.