this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add AbortSignal.any polyfill

+30
+30
src/polyfills.js
··· 11 11 }); 12 12 } 13 13 14 + // AbortSignal.any polyfill 15 + // Based on https://github.com/mozilla/pdf.js/pull/19681/files 16 + if ('AbortSignal' in window && !AbortSignal.any) { 17 + AbortSignal.any = function (iterable) { 18 + const ac = new AbortController(); 19 + const { signal } = ac; 20 + 21 + // Return immediately if any of the signals are already aborted. 22 + for (const s of iterable) { 23 + if (s.aborted) { 24 + ac.abort(s.reason); 25 + return signal; 26 + } 27 + } 28 + 29 + // Register "abort" listeners for all signals. 30 + for (const s of iterable) { 31 + s.addEventListener( 32 + 'abort', 33 + () => { 34 + ac.abort(s.reason); 35 + }, 36 + { signal }, // Automatically remove the listener. 37 + ); 38 + } 39 + 40 + return signal; 41 + }; 42 + } 43 + 14 44 // URL.parse() polyfill 15 45 if ('URL' in window && typeof URL.parse !== 'function') { 16 46 URL.parse = function (url, base) {