Skip to content

Commit

Permalink
fix: queueMicrotask fallback will error
Browse files Browse the repository at this point in the history
closes #2
  • Loading branch information
mihar-22 committed Jun 27, 2022
1 parent a70746f commit 0e0bea4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function createScheduler(onFlush?: () => void) {
const seen = new Set<() => void>();
const queue = new Set<() => void>();
const microtask = Promise.resolve();
const queueTask = queueMicrotask ?? microtask.then;
const queueTask = typeof queueMicrotask !== 'undefined' ? queueMicrotask : microtask.then;

function enqueue(task: () => void) {
// `seen` is only populated during a flush.
Expand Down

0 comments on commit 0e0bea4

Please sign in to comment.