Add AbortSignal.timeout polyfill
This commit is contained in:
parent
e153f9f541
commit
c538cfeaaa
13
src/main.jsx
13
src/main.jsx
|
@ -11,6 +11,19 @@ if (import.meta.env.DEV) {
|
|||
import('preact/debug');
|
||||
}
|
||||
|
||||
// AbortSignal.timeout polyfill
|
||||
// Temporary fix from https://github.com/mo/abortcontroller-polyfill/issues/73#issuecomment-1541180943
|
||||
// Incorrect implementation, but should be good enough for now
|
||||
if ('AbortSignal' in window) {
|
||||
AbortSignal.timeout =
|
||||
AbortSignal.timeout ||
|
||||
((duration) => {
|
||||
const controller = new AbortController();
|
||||
setTimeout(() => controller.abort(), duration);
|
||||
return controller.signal;
|
||||
});
|
||||
}
|
||||
|
||||
render(
|
||||
<HashRouter>
|
||||
<App />
|
||||
|
|
Loading…
Reference in a new issue