Skip to content

Commit

Permalink
Fix typo in callbacks (#4122)
Browse files Browse the repository at this point in the history
## Summary

This PR fixes a typo: calbacks → callbacks.

## Test plan

Run the Example app.
  • Loading branch information
tomekzaw authored Mar 1, 2023
1 parent 3fca836 commit 18b6f2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/reanimated2/initializers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function setupRequestAnimationFrame() {
global.__frameTimestamp = undefined;
});
}
// Reanimated currently does not support cancelling calbacks requested with
// Reanimated currently does not support cancelling callbacks requested with
// requestAnimationFrame. We return -1 as identifier which isn't in line
// with the spec but it should give users better clue in case they actually
// attempt to store the value returned from rAF and use it for cancelling.
Expand Down
10 changes: 5 additions & 5 deletions src/reanimated2/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ let _runOnUIQueue: Array<[ComplexWorkletFunction<any[], any>, any[]]> = [];
export function setupSetImmediate() {
'worklet';

let immediateCalbacks: Array<() => void> = [];
let immediateCallbacks: Array<() => void> = [];

// @ts-ignore – typescript expects this to conform to NodeJS definition and expects the return value to be NodeJS.Immediate which is an object and not a number
global.setImmediate = (callback: () => void): number => {
immediateCalbacks.push(callback);
immediateCallbacks.push(callback);
return -1;
};

global.__flushImmediates = () => {
for (let index = 0; index < immediateCalbacks.length; index += 1) {
for (let index = 0; index < immediateCallbacks.length; index += 1) {
// we use classic 'for' loop because the size of the currentTasks array may change while executing some of the callbacks due to setImmediate calls
immediateCalbacks[index]();
immediateCallbacks[index]();
}
immediateCalbacks = [];
immediateCallbacks = [];
};
}

Expand Down

0 comments on commit 18b6f2c

Please sign in to comment.