In my MainView I have JS like:
var Observable = require("FuseJS/Observable");
var auth = Observable();
function changeAuth(args) {
auth.value = args.auth;
console.log(JSON.stringify(auth.value)); //this shows correct value
}
module.exports = {
auth: auth,
changeAuth: changeAuth,
}
After that in the child component I try to do:
var mainview = require("main-view.js");
console.log(JSON.stringify(mainview.auth));
but this gives a null
value every time. Tried to tie that up in onValueChanged
but that didn’t help.
Am I missing something? Is there a better way to pass the global variable to child components?