Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd398265

Browse files
fix: Use window.setTimeout/setInterval for browser compatibility
- Replace setTimeout/setInterval with window.setTimeout/window.setInterval- Replace clearTimeout/clearInterval with window.clearTimeout/window.clearInterval- Fixes TypeScript error: Type 'Timeout' is not assignable to type 'number'- Ensures proper browser environment timer typesCo-authored-by: BrunoQuaresma <3165839+BrunoQuaresma@users.noreply.github.com>
1 parent834b2e5 commitd398265

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎site/src/hooks/useRetry.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ export function useRetry(options: UseRetryOptions): UseRetryReturn {
7676

7777
constclearTimers=useCallback(()=>{
7878
if(timeoutRef.current){
79-
clearTimeout(timeoutRef.current);
79+
window.clearTimeout(timeoutRef.current);
8080
timeoutRef.current=null;
8181
}
8282
if(countdownRef.current){
83-
clearInterval(countdownRef.current);
83+
window.clearInterval(countdownRef.current);
8484
countdownRef.current=null;
8585
}
8686
startTimeRef.current=null;
@@ -128,23 +128,23 @@ export function useRetry(options: UseRetryOptions): UseRetryReturn {
128128
startTimeRef.current=Date.now();
129129

130130
// Start countdown timer
131-
countdownRef.current=setInterval(()=>{
131+
countdownRef.current=window.setInterval(()=>{
132132
if(startTimeRef.current){
133133
constelapsed=Date.now()-startTimeRef.current;
134134
constremaining=Math.max(0,delay-elapsed);
135135
setTimeUntilNextRetry(remaining);
136136

137137
if(remaining<=0){
138138
if(countdownRef.current){
139-
clearInterval(countdownRef.current);
139+
window.clearInterval(countdownRef.current);
140140
countdownRef.current=null;
141141
}
142142
}
143143
}
144144
},100);// Update every 100ms for smooth countdown
145145

146146
// Schedule the actual retry
147-
timeoutRef.current=setTimeout(()=>{
147+
timeoutRef.current=window.setTimeout(()=>{
148148
performRetry();
149149
},delay);
150150
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp