I have a module.js that must be loaded; In order to work needs objectX;
How do I pass the objectX to the module.js in the require method provided by node.js?
thanks
// my module.js
objectX.add('abc');
// error: objectX is undefined
I would like a way to do it, without having to change all my classes because would take a lot of time… and they way it is has good performance for the client side. (I mix clientfiles with serverfiles***)
The module that you write can export a single function. When you require the module, call the function with your initialization argument. That function can return an Object (hash) which you place into your variable in the require-ing module. In other words:
main.js
arithmetic.js: