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
// In a worker// Handle promise rejection...self.onunhandledrejection((event: PromiseRejectionEvent)=>{throwevent.reason;});// ...so that let main thread know this promise is rejected.Promise.new((resolve,reject)=>{thrownewError('Oops!');});
But I get Property 'onunhandledrejection' does not exist on type 'WorkerGlobalScope & typeof globalThis'..
The unhandledrejection event is useful for debugging when you write some code that imports modules asynchronously in a Worker.
I am not sure whether these events / handlers in WorkerGlobalScope context are defined by specifications, but at least MDN says "typically, this is the window, but may also be a Worker" and it works in a Worker.
The text was updated successfully, but these errors were encountered:
This should work:
But I get
Property 'onunhandledrejection' does not exist on type 'WorkerGlobalScope & typeof globalThis'.
.The
unhandledrejection
event is useful for debugging when you write some code that imports modules asynchronously in a Worker.I am not sure whether these events / handlers in
WorkerGlobalScope
context are defined by specifications, but at least MDN says "typically, this is the window, but may also be aWorker
" and it works in a Worker.The text was updated successfully, but these errors were encountered: