eta
eta copied to clipboard
feat: adding globalAwait option
Implements feature of #99.
This feature allows us to add all data objects in an array and to await for it globally (only when the globalAwait
option is set to true in the config).
This adds almost no overhead at runtime (adding a for loop to generate the array push, but that's neglectable overhead), because Promise.all
just returns the value of synchronous functions and variables and only awaits for asynchronous functions. This could even be the default behavior when resolving templates (removing the option).
This allows us to speed things up a lot when having a lot of asynchronous functions in our data object.
Because this doesn't change anything about how this template engine works and just adds some extra speed, I don't think this is an out of scope feature, it is very useful when dealing with asynchronous functions.
Congratulations :tada:. DeepCode analyzed your code in 5.62 seconds and we found no issues. Enjoy a moment of no bugs :sunny:.
👉 View analysis in DeepCode’s Dashboard | Configure the bot
Sorry for taking so long, I will take a look at this today.
@shadowtime2000 This should be good !
Hey @shadowtime2000, sorry for the late response. I can't really think of a good way to test as I'm not familiar with unit tests in JS / TS. We're really just adding everything in an array and awaiting for it so I don't think we need any new fancy tests compared to the existing ones.
@SilentVoid13 Sorry for the late response.
Sorry, I am a little scared of merging something like this which is kind of hard to test so I am going to put this on hold I guess. Sorry again.
I'm going to close this as stale and because it's for Eta v2. I'd be open to accepting a pull request with this functionality for v3.