Created
July 2, 2021 00:02
-
-
Save gnbaron/ce94b2f2d53d8f4a5189062fae6e799e to your computer and use it in GitHub Desktop.
Flush promises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A promise that resolves on next tick. | |
* Beneficial for waiting for immediately resolved promises without | |
* lengthy promise chains. | |
*/ | |
export const flushPromises = (): Promise<void> => | |
new Promise(resolve => setImmediate(resolve)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment