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
### Keybase proof | |
I hereby claim: | |
* I am izedx on github. | |
* I am ized (https://keybase.io/ized) on keybase. | |
* I have a public key ASDM4YCfwbmgEBtcDqlNtEtbnqBxIkAdzeLjOCnhr79S1Qo | |
To claim this, I am signing this object: |
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
/** | |
* Adds the passed function to the JavaScript Message Queue to be executed by the Event Loop, | |
* wraps a Promise around that and resolves any asynchronous values. | |
* This allows to call a function asynchronously and on the Event Loop, which doesn't grow the call stack, | |
* but can be used in a synchronous manner using await. | |
* @param fn The function to be executed, can be async. | |
* @param args The arguments to be passed to this function. | |
*/ | |
function immediate<T, K>(fn: (...args: K[]) => T|Promise<T>, ...args: K[]) { |