-
Notifications
You must be signed in to change notification settings - Fork 156
Is it possible to hook into an asynchronous function? #1030
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
Comments
async_hooks in node is implemented using V8's PromiseHook(s)1 API. Assuming you're familiar with it, would that work for you? 1 V8 is not wholly consistent on whether it's singular or plural... |
I'm not that familiar with asynchronous processing, but I'm hoping that the js engine has something like this, as you say. Promise lifecycle hooks in V8 (It's a bit of an old document) : |
Adding an API inspired by V8's sounds like a good idea to me! |
Lets embedders track promise chains. Closely modelled after the V8 API of the same name. Fixes: quickjs-ng#1030
@nabetti1720 can you check if #1033 works for you? |
Lets embedders track promise chains. Closely modelled after the V8 API of the same name. Fixes: quickjs-ng#1030
Hello everyone, I'm part of an experimental project called LLRT. As you know, LLRT uses quickjs-ng through RquickJS (Rust binding). I'm very grateful to be able to use such a great js engine.
Currently, we are trying to implement async_hooks, which is one of the nodejs modules. A draft has been made, but we want to make it better.
The current implementation creates hooking points for
Promise
,setTimeout
, andsetImmediate
by patching JavaScript, but we would prefer something more native.Current Implementation :
https://github.com/awslabs/llrt/pull/947/files#diff-801982e5802bc4502f37e9606801a09f83274a59675f658ee91eac80c54925a5
Is there a better way?
The text was updated successfully, but these errors were encountered: