node-irsdk icon indicating copy to clipboard operation
node-irsdk copied to clipboard

Port to N-API?

Open apihlaja opened this issue 6 years ago • 2 comments

It seems Node.js have new API for native addons, should take a look if it makes sense to port: https://github.com/nodejs/node-addon-api

apihlaja avatar Dec 03 '17 18:12 apihlaja

N-API is experimental as of Node.js v9: https://nodejs.org/dist/v9.3.0/docs/api/addons.html#addons_n_api

As far as I understood, current nan based C++ code should continue to work. So there is no immediate need to port to new API, but porting might make it easier to improve performance. Not like I'd have noticed any performance issues but obviously you dont want to waste CPU cycles when driving.

The current version of node-irsdk runs in main event loop, and polls memory mapped file from javascript. That's something I would like to get rid of ie. C++ addon should be event emitter itself and do polling in C++ land. It seems running outside of main event loop will be a bit easier with N-API: https://nodejs.org/dist/v9.3.0/docs/api/n-api.html#n_api_custom_asynchronous_operations

apihlaja avatar Dec 30 '17 10:12 apihlaja

Error: The module '\?\C:\Users\twk-b\itwkracing\node\node_modules\node-irsdk\build\Release\IrSdkNodeBindings.node'
was compiled against a different Node.js version using NODE_MODULE_VERSION 64. This version of Node.js requires NODE_MODULE_VERSION 72. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install).

this is on upgrade to node-12 from node-12. npm rebuild, rmrf package-lock.json node_modules npm install also fails.

twk-b avatar May 18 '20 19:05 twk-b