## Miscellaneous Node Helpers
Nan::MakeCallback()
NAN_MODULE_INIT()
Nan::Export()
Wrappers around `node::MakeCallback()` providing a consistent API across all supported versions of Node.
Use `MakeCallback()` rather than using `v8::Function#Call()` directly in order to properly process internal Node functionality including domains, async hooks, the microtask queue, and other debugging functionality.
Signatures:
`c++
v8::Local
v8::Local
int argc,
v8::Local
v8::Local
v8::Local
int argc,
v8::Local
v8::Local
const char* method,
int argc,
v8::Local
`
Used to define the entry point function to a Node add-on. Creates a function with a given `name` that receives a `target` object representing the equivalent of the JavaScript `exports` object.
See example below.
A simple helper to register a `v8::FunctionTemplate` from a JavaScript-accessible method (see [Methods](./methods.md)) as a property on an object. Can be used in a way similar to assigning properties to `module.exports` in JavaScript.
Signature:
`c++
void Export(v8::Local
`
Also available as the shortcut `NAN_EXPORT` macro.
Example:
`c++
NAN_METHOD(Foo) {
}
NAN_MODULE_INIT(Init) {
NAN_EXPORT(target, Foo);
}
`
Reviews
There are no reviews yet.