Skip to content

Commit

Permalink
Fix browser compatibility (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
buschtoens committed Dec 6, 2020
1 parent bddde18 commit b98a872
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -22,7 +22,7 @@ const pTimeout = (promise, milliseconds, fallback, options) => new Promise((reso
...options
};

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

0 comments on commit b98a872

Please sign in to comment.