Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing page about async_hooks #1430

Open
pmunin opened this issue Feb 14, 2025 · 2 comments
Open

Confusing page about async_hooks #1430

pmunin opened this issue Feb 14, 2025 · 2 comments

Comments

@pmunin
Copy link

pmunin commented Feb 14, 2025

In your article about async_hooks - you say:

We strongly discourage the use of the async_hooks API. Other APIs that can cover most of its use cases include:
AsyncLocalStorage tracks async context

but AsyncLocalStorage is a part of async_hooks, which you discourage to use.

In your article it's not clear what alternative to async_hooks do you suggest to use?

@TriMoon
Copy link

TriMoon commented Feb 18, 2025

Most likely the non-async variant of the functions you try to use.
In your case: localStorage, the same name but without Async infront 😉

@pmunin
Copy link
Author

pmunin commented Feb 18, 2025

Most likely not :-) because use cases of localStorage has nothing in common with use cases of async_hooks and AsyncLocalStorage. More over localStorage is purely browser thing and not available on backend natively, while async_hooks is purely backend module not available on frontend natively

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants