This starts using Nan::AsyncResource (aka Node::AsyncResource under the hood) to enable us to upgrade to latest nan without hitting deprecation warnings (that we turn into errors in skel due to our use of -Werror).
What is Node::AsyncResource?
It looks like it is a simple C++ class that needs to be created and passed to all callbacks. It looks like it is needed to be able to support this JS-land API: https://nodejs.org/api/async_hooks.html
This starts using
Nan::AsyncResource
(akaNode::AsyncResource
under the hood) to enable us to upgrade to latest nan without hitting deprecation warnings (that we turn into errors in skel due to our use of-Werror
).What is Node::AsyncResource?
It looks like it is a simple C++ class that needs to be created and passed to all callbacks. It looks like it is needed to be able to support this JS-land API: https://nodejs.org/api/async_hooks.html
My understanding is that we need to create one with a unique name. The
Nan
wrappers make this easy: https://github.com/nodejs/nan/blob/master/doc/asyncworker.md#nanasyncworker.For the one place what we call a callback directly (not using
Nan
) this PR creates aNan::AsyncResource
directly.refs https://github.com/mapbox/mapbox-gl-native/issues/11288 refs https://github.com/mapbox/node-cpp-skel/pull/125