- You can trigger any method in the same process whenever a value changed.
- We bring Qt Framework Signals & Slots logic to NodeJs, you can see how it works via Qt Signals & Slots.
- This will be much faster and performance focused then any other js based observers.
const nss = require('nss'); // for now call it require('path/to/build/Release/nss');
nss.initValue('loading', false); // initialize the value
nss.insertSlot('loading', (val) => console.log(val)); // Set a listener for value changes
nss.insertSlot('loading', (val) => console.log(val)); // Also set another listener for same value changes
nss.emitSignal('loading', true); // Emit a signal from anywhere to trigger listener methods
Before started this is a C addon, so to compile and run it, you should have installed node-gyp
globally. To do that
yarn global add node-gyp
After that, clone the repo and type npm start.
yarn start
This will build the C codes and run it with the example javascript codes. You can see what does the "start" command inside package.json file.
If you are working under OSX distributions, you can do the following command and start to work in Xcode.
yarn run xcode-debug
Benefits of working in Xcode that you can set breakpoints and use debugger.
After executing the above command, you gonna find an .xcodeproj folder under the build folder.
Here is how you will prepare your Xcode env to run your JavaScript codes. Debug NodeJs Native addons in Xcode
- C source codes are found under
src
folder. - Javascript examples are found under
example
folder. - Docs are found under
docs
folder.
In any project which ever is powered by NodeJs. some examples are ElectronJs, NodeJs BackEnd Development, Embedded NodeJs projects, Mobile Frameworks(Don't forget to make manual changes) etc.