By taking advantage of the async_hooks API, users of jumpgen would be able to import the API from jumpgen/async_hooks instead of destructuring or passing around the context object within the generator.
There are two benefits I see to using async_hooks (more specifically, AsyncLocalStorage).
- Import auto-completion in IDEs
- Allow functions declared outside the generator to use jumpgen APIs, without having to pass it as an explicit argument
By taking advantage of the async_hooks API, users of jumpgen would be able to import the API from
jumpgen/async_hooksinstead of destructuring or passing around the context object within the generator.There are two benefits I see to using
async_hooks(more specifically,AsyncLocalStorage).