Skip to content

Commit

Permalink
fix(web): use anonymous function in setTimeout in ponyfill of `requ…
Browse files Browse the repository at this point in the history
…estIdelCallback` (immich-app#16264)
  • Loading branch information
ykzts authored Feb 24, 2025
1 parent edbcf17 commit 4be2351
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/src/lib/utils/idle-callback-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ interface RequestIdleCallbackOptions {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function fake_requestIdleCallback(cb: (deadline: RequestIdleCallback) => any, _?: RequestIdleCallbackOptions) {
const start = Date.now();
return setTimeout(cb({ didTimeout: false, timeRemaining: () => Math.max(0, 50 - (Date.now() - start)) }), 100);
return setTimeout(() => {
cb({ didTimeout: false, timeRemaining: () => Math.max(0, 50 - (Date.now() - start)) });
}, 100);
}

function fake_cancelIdleCallback(id: number) {
Expand Down

0 comments on commit 4be2351

Please sign in to comment.