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/1-getting-started/4_object_factory/napi/addon.c. All files
src/1-getting-started/4_object_factory/napi/addon.c
@@ -0,0 +1,30 @@+#include <assert.h>+#include <node_api.h>++static napi_value CreateObject(napi_env env, const napi_callback_info info) {+ napi_status status;++ size_t argc = 1;+ napi_value args[1];+ status = napi_get_cb_info(env, info, &argc, args, NULL, NULL);+ assert(status == napi_ok);++ napi_value obj;+ status = napi_create_object(env, &obj);+ assert(status == napi_ok);++ status = napi_set_named_property(env, obj, "msg", args[0]);+ assert(status == napi_ok);++ return obj;+}++static napi_value Init(napi_env env, napi_value exports) {+ napi_value new_exports;+ napi_status status = napi_create_function(+ env, "", NAPI_AUTO_LENGTH, CreateObject, NULL, &new_exports);+ assert(status == napi_ok);+ return new_exports;+}++NAPI_MODULE(NODE_GYP_MODULE_NAME, Init)