1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Use destructured signal (#10115)

This commit is contained in:
David Walsh 2020-12-23 10:15:07 -06:00 committed by GitHub
parent 64adcae08d
commit c42087d044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,10 +1,10 @@
const fetchWithTimeout = ({ timeout = 120000 } = {}) => { const fetchWithTimeout = ({ timeout = 120000 } = {}) => {
return async function _fetch(url, opts) { return async function _fetch(url, opts) {
const abortController = new window.AbortController() const abortController = new window.AbortController()
const abortSignal = abortController.signal const { signal } = abortController
const f = window.fetch(url, { const f = window.fetch(url, {
...opts, ...opts,
signal: abortSignal, signal,
}) })
const timer = setTimeout(() => abortController.abort(), timeout) const timer = setTimeout(() => abortController.abort(), timeout)