Fix browser compatibility (#18)

This commit is contained in:
Jan Buschtöns 2020-12-06 10:12:12 +01:00 committed by GitHub
parent bddde18124
commit b98a872b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ const pTimeout = (promise, milliseconds, fallback, options) => new Promise((reso
...options ...options
}; };
const timer = options.customTimers.setTimeout(() => { const timer = options.customTimers.setTimeout.call(undefined, () => {
if (typeof fallback === 'function') { if (typeof fallback === 'function') {
try { try {
resolve(fallback()); resolve(fallback());
@ -49,7 +49,7 @@ const pTimeout = (promise, milliseconds, fallback, options) => new Promise((reso
} catch (error) { } catch (error) {
reject(error); reject(error);
} finally { } finally {
options.customTimers.clearTimeout(timer); options.customTimers.clearTimeout.call(undefined, timer);
} }
})(); })();
}); });