-
Notifications
You must be signed in to change notification settings - Fork 70
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
deprecation warning from Nan::Callback::call #209
Comments
Looks like those interfaces are deprecated in favor of ones that additionally pass a https://github.com/nodejs/nan/blob/master/doc/callback.md#api_nan_callback |
so src/node_nanomsg.cc:233 is easy; we already subclass diff --git a/src/node_nanomsg.cc b/src/node_nanomsg.cc
index ab66db5..9b40b5e 100644
--- a/src/node_nanomsg.cc
+++ b/src/node_nanomsg.cc
@@ -230,7 +230,7 @@ public:
Local<Value> argv[] = { Nan::New<Number>(err) };
- callback->Call(1, argv);
+ callback->Call(1, argv, async_resource);
};
private: is necessary. The change for poll_ctx.cc looks more involved, since we hand rolled a bit. |
Looks like the Nan::Callback::Call() API deprecated bare calls that don't pass a new Nan::AsyncResource(). Luckily, in this case we were already subclassing Nan::AsyncWorker, which has a member named `async_resource` so all we have to do is explicitly pass this along. I wonder if Nan should just do this for me? *hmm* Bug #209
* support node v12 - upgrade nan to v2.14 - use Nan::Utf8String rather than v8::String::Utf8Value Fixes #206 * fix 1 of the 2 Nan::Callback::Call deprecation warnings Looks like the Nan::Callback::Call() API deprecated bare calls that don't pass a new Nan::AsyncResource(). Luckily, in this case we were already subclassing Nan::AsyncWorker, which has a member named `async_resource` so all we have to do is explicitly pass this along. I wonder if Nan should just do this for me? *hmm* Bug #209
This allows PollCtx to leave the lifetime management of the callback to AsyncWorker, and allows us to use the AsyncWorker's async_resource. No change in `make perf` was observed, though it's a little noisy. We must implement the pure virtual function interface for Exectute(), but I'm not sure what it's for. Also, I believe that ~AsyncWorker() deletes the passed callback, as all of the examples show calls to new Nan::Callback(). Fixes #209
via
npm install
:https://github.com/nodejs/nan/blob/master/doc/node_misc.md#api_nan_make_callback
The text was updated successfully, but these errors were encountered: