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

Re-use of project as browser polyfill? #15

Open
rektide opened this issue Oct 31, 2017 · 1 comment
Open

Re-use of project as browser polyfill? #15

rektide opened this issue Oct 31, 2017 · 1 comment

Comments

@rektide
Copy link

rektide commented Oct 31, 2017

Hello. I've been thinking about re-creating the async_hook capabilities for the browser, in whatever kind of limited fashion. It would be interesting to me to try to create observability points for promises, and Node's async_hook seems like the only standard we have for that at the moment.

How much of this project (at 0.7.1, it's last release) do you think is still applicable, or useful, if one wanted to shim Node's async-hooks?

Do you have any thoughts surrounding asyncId's, which are extensive in the Node API but absent here? How close to implementable are those in userland?

Making the Embedder API available would be another key feature of a good browser implementation of async_hook. Do you have any thoughts on how that may be mated to the work in this project?

@AndreasMadsen
Copy link
Owner

AndreasMadsen commented Oct 31, 2017

A big problem we faced was that async functions don't depend on global.Promise but instead the internal [[Promise]]. It is thus not possible to instrument async function in the browser. In node.js we collaborated with the V8 team to create a C++ API for this. So I don't think this can be done.

How much of this project (at 0.7.1, it's last release) do you think is still applicable, or useful, if one wanted to shim Node's async-hooks?

No much. The timeout patches are properly fine, but the rest can't really be reused. And the browser has a huge API surface.

Do you have any thoughts surrounding asyncId's, which are extensive in the Node API but absent here? How close to implementable are those in userland?

This module had asyncId's. Implementing asyncId is simple if you already have all the events. It is just a number that increments for every init event.

Making the Embedder API available would be another key feature of a good browser implementation of async_hook. Do you have any thoughts on how that may be mated to the work in this project?

The Embedder API is also simple. It will just be an abstraction upon the internal API you will need to create for the patches.

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