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

Why do these two examples need a static FunctionReference?

seishun opened this issue · comments

Napi::FunctionReference NativeAddon::constructor;

Napi::FunctionReference NativeEmitter::constructor;

It's not referred anywhere other than the Init function and having an "immortal" Napi::FunctionReference seems unnecessary since the constructor isn't invoked from native code.

Curiously, these two examples were untouched by dc86a66, which replaced the usage of a static FunctionReference with instance data in examples that do need to keep the constructor alive.