Skip to content

node-api: implement JS inheritance from C++

This serves to outline the basic idea before implementing the rest (unit testing):

  • cut napi_define_class in two - napi_declare_class and napi_instantiate_class
  • the new napi_define_class is simply a helper that calls both
  • napi_declare_class returns a new type of napi_value that can be called napi_class that is essentially a v8::FunctionTemplate
  • this new type of value supports inheritance
  • on engines other than V8, where Function and FunctionTemplate are implemented as one object, this new napi value will simply be the Function

Merge request reports

Loading