Skip to content

Instantly share code, notes, and snippets.

@snewcomer
Last active September 29, 2019 22:20
Show Gist options
  • Save snewcomer/c7077fd338dc09c9a9c49cb26365430d to your computer and use it in GitHub Desktop.
Save snewcomer/c7077fd338dc09c9a9c49cb26365430d to your computer and use it in GitHub Desktop.
queueMicroTask

The microtask queue is useful for allowing the current browser task to finish while pushing some logic to happen immediately after that task (or next task).

  • "click" event with non trivial, expensive logic. To allow the browser to finish that event, return sync control to that task while throwing the resulting logic in a queueMicrotask callback.
  • async rendering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment