Skip to content

Commit

Permalink
fix: compile error on web
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirezaHadjar committed Jan 17, 2025
1 parent e5d9930 commit 3970ebd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-fast-confetti",
"version": "0.8.1",
"version": "0.8.2",
"description": "The fastest confetti animation library in react native",
"source": "./src/index.tsx",
"main": "./lib/commonjs/index.js",
Expand Down Expand Up @@ -175,4 +175,4 @@
"type": "library",
"version": "0.41.2"
}
}
}
14 changes: 7 additions & 7 deletions src/hooks/useAnimatedTimeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ const TIMEOUT_ID = makeMutable(0);

export type AnimatedTimeoutID = number;

function removeFromPendingTimeouts(id: AnimatedTimeoutID): void {
const removeFromPendingTimeouts = (id: AnimatedTimeoutID): void => {
'worklet';
PENDING_TIMEOUTS.modify((pendingTimeouts) => {
'worklet';
delete pendingTimeouts[id];
return pendingTimeouts;
});
}
};

export function setAnimatedTimeout<F extends AnyFunction>(
export const setAnimatedTimeout = <F extends AnyFunction>(
callback: F,
delay: number
): AnimatedTimeoutID {
): AnimatedTimeoutID => {
'worklet';
let startTimestamp: number;

Expand All @@ -45,9 +45,9 @@ export function setAnimatedTimeout<F extends AnyFunction>(
requestAnimationFrame(step);

return currentId;
}
};

export function clearAnimatedTimeout(handle: AnimatedTimeoutID): void {
export const clearAnimatedTimeout = (handle: AnimatedTimeoutID): void => {
'worklet';
removeFromPendingTimeouts(handle);
}
};

0 comments on commit 3970ebd

Please sign in to comment.