@ 260528.1

231103.1 · 7f4a9ed91bbecb84e39f4bc8030247ce5116ddf8

Reorganize examples into categorized folders (#341)

* refactor: create directory structure to organize exmaples
* test: update test_all to work with new directory structure
* fix: bug in test_all if no package.json scripts
* test: cleanup output of test_all
* fix: remove default test script that throws from thread_safe_function_with_object_wrap
* fix: remove build_with_cmake from .gitignore
* fix: swith to ' from " and remove subdir from getAllTests call
* test: add extra test cases for npm start and just running the pkgJson.main with node
* refactor: move all examples to src directory
* refactor: add numbers to categories so they are ordered in the src folder
* refactor: simplify getAllExamples in test_all.js
* docs: add directory structure to README.md
* docs: update directory structure to README.md
* docs: update directory structure to README.md
* docs: update directory structure to README.md
* docs: update directory structure example in readme
* add back build_with_cmake --------- Co-authored-by: legendecas <legendecas@gmail.com>

reading declarations

Changes to src/2-js-to-native-conversion/8_passing_wrapped/node-addon-api/addon.cc. All files

src/2-js-to-native-conversion/8_passing_wrapped/node-addon-api/addon.cc

new file mode 100644@@ -0,0 +1,31 @@+#include <napi.h>+#include "myobject.h"++using namespace Napi;++Napi::Object CreateObject(const Napi::CallbackInfo& info) {+  return MyObject::NewInstance(info.Env(), info[0]);+}++Napi::Number Add(const Napi::CallbackInfo& info) {+  Napi::Env env = info.Env();+  MyObject* obj1 =+      Napi::ObjectWrap<MyObject>::Unwrap(info[0].As<Napi::Object>());+  MyObject* obj2 =+      Napi::ObjectWrap<MyObject>::Unwrap(info[1].As<Napi::Object>());+  double sum = obj1->Val() + obj2->Val();+  return Napi::Number::New(env, sum);+}++Napi::Object InitAll(Napi::Env env, Napi::Object exports) {+  MyObject::Init(env, exports);++  exports.Set(Napi::String::New(env, "createObject"),+              Napi::Function::New(env, CreateObject));++  exports.Set(Napi::String::New(env, "add"), Napi::Function::New(env, Add));++  return exports;+}++NODE_API_MODULE(addon, InitAll)