Nan::Callback
makes it easier to use v8::Function
handles as callbacks. A class that wraps a v8::Function
handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution.
```c++ class Callback { public: Callback();
explicit Callback(const v8::Local
~Callback();
bool operator==(const Callback &other) const;
bool operator!=(const Callback &other) const;
v8::Local
MaybeLocal
MaybeLocal
void SetFunction(const v8::Local
v8::Local
bool IsEmpty() const;
void Reset(const v8::Local
void Reset();
MaybeLocal
// Deprecated versions. Use the versions that accept an async_resource instead
// as they run the callback in the correct async context as specified by the
// resource. If you want to call a synchronous JS function (i.e. on a
// non-empty JS stack), you can use Nan::Call instead.
v8::Local
v8::Local
v8::Local
Example usage:
c++
v8::Local<v8::Function> function;
Nan::Callback callback(function);
callback.Call(0, 0);