In my application I've got two browser-windows (main_win and info_win). Now
- I want to access a variable which is hold in global.js.
- In main_win_controller.js I do a
global = require('../global.js');
and then write to the variable initial/once like this:global.myVar = "from main_win";
- In info_win_controller.js I do a
global = require('../global.js');
and then write to the variable initial/once like this:global.myVar = "from info_win";
- After doing so I read the variables continiousely via a interval for testing in both files. Both outputs are different so it seems like I've got two independent instances of my global.js
How can I get rid of this? I want to realise a central part of my application where I can define special reuseable functions (in my example I want to use here the GPIO-Pins of my Raspberry Pi via the use of a special npm-module)
Aucun commentaire:
Enregistrer un commentaire