UNPKG

check-ethereum-scanner

Version:

Safety checks for new Ethereum tokens

18 lines (16 loc) 847 B
export function polyfillNeeded(self) { if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) { console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill'); return true; } // Note that the "unfetch" minimal fetch polyfill defines fetch() without // defining window.Request, and this polyfill need to work on top of unfetch // so the below feature detection needs the !self.AbortController part. // The Request.prototype check is also needed because Safari versions 11.1.2 // up to and including 12.1.x has a window.AbortController present but still // does NOT correctly implement abortable fetch: // https://bugs.webkit.org/show_bug.cgi?id=174980#c2 return ( (typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal')) || !self.AbortController ); }