nodejs / node-addon-examples

Node.js C++ addon examples from http://nodejs.org/docs/latest/api/addons.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add example that uses NODE_API_ADDON for addon registration

KevinEady opened this issue · comments

It appears that all of our examples use the NODE_API_MODULE macro to register native addons. It would be helpful to add an
example that uses NODE_API_ADDON registration, where the module extends Addon<T>.

This issue was raised because of a question on node-addon-api on when to use which macro: nodejs/node-addon-api#1190

Hi,

I want to write a new Binding for openCV, and since I'm writing it from scratch, I want to make it as up-to-date as possible.

So I would like to use NODE_API_ADDON

My current sample code is here

the code builds fine, but my exported object is empty.

This issue was resolved in #209.