`setImmediate()` for N-API code
npm install setimmediate-napisetimmediate-napi
=================






Installation
------------
Install with npm:
`` bash`
$ npm install setimmediate-napi
Usage
-----
In your binding.gyp:
`python`
'include_dirs': [" "
(Just have " somewhere in that list, ok?)
In your C++ code:
`c++
#include
int a = 10;
SetImmediate(env, [a]() {
/ do something with a ... /
});
`
Keep in mind:
- You need to use References to keep track of JS objects, since this code runs asynchronously.MakeCallback
- Use rather than Call` to make sure Node.js can track your async context.
- This function can be invoked even when executing JS code itself is not allowed.