Skip to content

Commit

Permalink
switch to queueMicroTask
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed May 2, 2024
1 parent 4ab4b99 commit 04f7695
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,6 @@ let rerenderQueue = [];

let prevDebounce;

const defer =
typeof Promise == 'function'
? Promise.prototype.then.bind(Promise.resolve())
: setTimeout;

/**
* Enqueue a rerender of a component
* @param {Component} c The component to rerender
Expand All @@ -207,7 +202,7 @@ export function enqueueRender(c) {
prevDebounce !== options.debounceRendering
) {
prevDebounce = options.debounceRendering;
(prevDebounce || defer)(process);
(prevDebounce || queueMicrotask)(process);
}
}

Expand Down

0 comments on commit 04f7695

Please sign in to comment.