You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lettimeoutId;try{constcontroller=newAbortController();timeoutId=setTimeout(()=>controller.abort(),5000);constres=awaitfetch(url,{signal: controller.signal});constbody=awaitres.json();}catch(e){if(e.name==="AbortError"){// Notify the user of abort.// Note this will never be a timeout error!}else{// A network error, or some other problem.console.log(`Type: ${e.name}, Message: ${e.message}`);}}finally{clearTimeout(timeoutId);}
The text was updated successfully, but these errors were encountered:
jekorx
added
l10n-zh
Issues related to Chinese content.
needs triage
Triage needed by staff and/or partners. Automatically applied when an issue is opened.
labels
Dec 9, 2024
MDN URL
https://developer.mozilla.org/zh-CN/docs/Web/API/AbortSignal
与此议题相关的小节或标题?
No response
哪些信息是错误、无用或不完善的?
translated-content/files/zh-cn/web/api/abortsignal/index.md
Lines 116 to 133 in acf9d20
finally 中无法读取到 try 代码块中的 timeoutId 变量
你期望看到什么?
你有什么支持的链接、参考或引用?
No response
你还想补充什么内容?
No response
MDN metadata
Page report details
zh-cn/web/api/abortsignal
The text was updated successfully, but these errors were encountered: