Comments (1)
This is probably a structure you should strive for anyway. Most of the examples out there already like libxml and leveldown are wrapping existing libraries in node/v8 compatible code so they have that structure implicitly. Keeping your application code pure and adding just a wrapper layer is a nice way to separate concerns and make it more portable if it ever needs to be. Consider structuring the code where there's a "library" and a "wrapper" that sit separately and the dependency is only from the wrapper to the library and not the other way around.
For most of my addons, I'm extending something that already exists so I'm only ever writing wrapper code and don't need the portability of having an extra layer but if I was starting with something fresh then I'd absolutely consider separating it out.
from node-addon-examples.
Related Issues (20)
- How to setting the binding.gyp file or cMake.js to use external libraries?
- How to create a C++ array then returns it to NodeJS? HOT 2
- How to cast an array to an string array?
- Multiple classes (wrapped objects) HOT 4
- C1083: Cannot open include file: 'napi.h': No such file or directory HOT 4
- How to use boolean in node_api.h? HOT 1
- Non ascii as function argument not working HOT 1
- How to add C++ library?
- Share memory between worker threads HOT 1
- Add async example to abi-stable-node-addon-examples
- /nix/store/v8imx1nvyz0hgvx9cbcmh6gp4ngw3ffj-binutils-2.35.1/bin/ld: /nix/store/9bh3986bpragfjmr32gay8p95k91q4gy-glibc-2.33-47/lib/crt1.o: in function `_start': /build/glibc-2.33/csu/../sysdeps/x86_64/start.S:104: undefined reference to `main' /nix/store/v8imx1nvyz0hgvx9cbcmh6gp4ngw3ffj-binutils-2.35.1/bin/ld: /tmp/ccSAJfYK.o: in function `Init': main.c:(.text+0x6c): undefined reference to `napi_define_properties' /nix/store/v8imx1nvyz0hgvx9cbcmh6gp4ngw3ffj-binutils-2.35.1/bin/ld: /tmp/ccSAJfYK.o: in function `Method': main.c:(.text+0xe4): undefined reference to `napi_create_string_utf8' /nix/store/v8imx1nvyz0hgvx9cbcmh6gp4ngw3ffj-binutils-2.35.1/bin/ld: /tmp/ccSAJfYK.o: in function `_register_NODE_GYP_MODULE_NAME': main.c:(.text.startup+0x8): undefined reference to `napi_module_register' collect2: error: ld returned 1 exit status make: *** [Makefile:2: all] Error 1
- returning synchronous array in c++ addon HOT 10
- Add example that uses NODE_API_ADDON for addon registration HOT 3
- Node.js C++ Addon Documentation HOT 3
- Using NAPI with SIMD and pthreads
- With the `node-addon` I don't get any errors but the React Page doesn't show up
- Please add samples for languages like Go and Rust HOT 2
- Error binding C++ class member function as a method of an object with node-addon-api
- Improve `AsyncWorker` example handling `Object/Buffer/Uint8Array` as parameter HOT 2
- Migration tutorial fails without python2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-addon-examples.