You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for delayed work. I was on a vacation until last week. I'm looking into this issue now but need your confirmation.
Shouldn't we need to implement the async hooks wrapper(e.g. napi_async_init) first before implementing this feature? I found the related comments in the PR[1] but didn't find any follow-up change in C++ wrapper side. Do you have a plan to make a followup change? Otherwise, I'm available.
Is there any way to use callback scopes from a napi_async_work? Normally an async worker would create it's Javascript values from within the scope of the complete_callback, but there's an issue right now around error handling - there's no way to return a Javascript error from the execute_callback, just a string or manual workarounds.
Noticed the comments here mentioning an async hooks wrapper for napi_async_init; might be another use-case worth thinking about.
What's the story for new features like this when running precompiled libraries on older versions of Node? Would this library provide a backport for older Node.js versions or would a library depending on nodejs/node#18089 have to target Node.js 9.6.0+ only?
@rolftimmermans, in general not all new features would be backported to earlier versions. However, I am hoping that we will backport what becomes non-experimental in 10.x to 8.x (and we'll have to look at 6.x) in order to accelerate initial adoption.
The complication is that not all versions of 8.x will have the feature, is that something you can work around by requiring Node.js 8.X or higher ?
@ebickle I have a todo to look at the error issue with complete_callback, but I'm going to be travelling a fair amount over the next 3 weeks so I'm not quite sure how/when I'm going to get to it.
@mhdawson I guess it is possible to depend on a certain 8.X version, but it's less than ideal. The feature was introduced in 9.6 it seems, so not sure if the specific 8.X version would matter?
The issue is that if/when we backport, it will go into the latest 8.X release. So it would be available in 8.Y or later and 9.6 and later.
I see. It's probably less than ideal because a lot of distros have already shipped with Node 8. So people who can easily install a future 8.X version can probably also install 9 or 10.
The following code is how I implemented a C++ wrapper in my code currently. Maybe this is useful for someone looking to create a similar wrapper in this project?
Activity
romandev commentedon Feb 6, 2018
I'll take this issue.
mhdawson commentedon Feb 7, 2018
@romandev thanks !
romandev commentedon Feb 19, 2018
@mhdawson,
Sorry for delayed work. I was on a vacation until last week. I'm looking into this issue now but need your confirmation.
Shouldn't we need to implement the async hooks wrapper(e.g. napi_async_init) first before implementing this feature? I found the related comments in the PR[1] but didn't find any follow-up change in C++ wrapper side. Do you have a plan to make a followup change? Otherwise, I'm available.
[1] #140
mhdawson commentedon Mar 1, 2018
@romandev that is a very good point. If you can work on adding async hooks wrapper that would be great :)
ebickle commentedon Mar 5, 2018
Is there any way to use callback scopes from a napi_async_work? Normally an async worker would create it's Javascript values from within the scope of the complete_callback, but there's an issue right now around error handling - there's no way to return a Javascript error from the execute_callback, just a string or manual workarounds.
Noticed the comments here mentioning an async hooks wrapper for napi_async_init; might be another use-case worth thinking about.
rolftimmermans commentedon Mar 5, 2018
What's the story for new features like this when running precompiled libraries on older versions of Node? Would this library provide a backport for older Node.js versions or would a library depending on nodejs/node#18089 have to target Node.js 9.6.0+ only?
mhdawson commentedon Mar 5, 2018
@rolftimmermans, in general not all new features would be backported to earlier versions. However, I am hoping that we will backport what becomes non-experimental in 10.x to 8.x (and we'll have to look at 6.x) in order to accelerate initial adoption.
The complication is that not all versions of 8.x will have the feature, is that something you can work around by requiring Node.js 8.X or higher ?
mhdawson commentedon Mar 5, 2018
@ebickle I have a todo to look at the error issue with complete_callback, but I'm going to be travelling a fair amount over the next 3 weeks so I'm not quite sure how/when I'm going to get to it.
rolftimmermans commentedon Mar 6, 2018
@mhdawson I guess it is possible to depend on a certain 8.X version, but it's less than ideal. The feature was introduced in 9.6 it seems, so not sure if the specific 8.X version would matter?
mhdawson commentedon Mar 6, 2018
The issue is that if/when we backport, it will go into the latest 8.X release. So it would be available in 8.Y or later and 9.6 and later.
rolftimmermans commentedon Mar 6, 2018
I see. It's probably less than ideal because a lot of distros have already shipped with Node 8. So people who can easily install a future 8.X version can probably also install 9 or 10.
rolftimmermans commentedon Mar 6, 2018
The following code is how I implemented a C++ wrapper in my code currently. Maybe this is useful for someone looking to create a similar wrapper in this project?
mhdawson commentedon Mar 6, 2018
@rolftimmermans thanks.
@romandev FYI, in case you are first to get to working on adding support to the wrapper for callback scopes.
NickNaso commentedon Oct 21, 2018
Hi everyone I think that this issue could be close when we will land this PR #362 Is it right?
NickNaso commentedon Oct 23, 2018
@mhdawson could we close this issue now?
mhdawson commentedon Oct 23, 2018
Closing
NickNaso commentedon Nov 2, 2018
I'm closing this, we just released version 1.6.0 that contains the
Napi::CallbackScope. Feel free to reopen if I misunderstood something.