So I'm working with some export in js and do not understand the way they interact...
I have those two files :
imported file
export var a = 0;
// getter on a
export function A() {
return a;
}
// a custom evetn from a library, works on a trigger like usual js buttons
// triggers on a command base
register("command", (event) => {
a = 1;
}).SetCriteria("test");
index file
import { a, A } from "./importedFile.js";
// a custom event from a library, works on a trigger like usual js buttons
// triggers on a clock base
register("tick", (event) => {
console.log(a);
console.log(A());
})
However whatever I do on the command trigger (that does fire, I've tested it) I do not get any output on the index file... It stays at zero
Any idea why, something I've missed on the way exports works?
Thanks :)
0?1both foraandA()if you do the twoconsole.logs you've shown afterahas been updated in the source module; proof: stackblitz.com/edit/stackblitz-starters-ay4ha6?file=main.js. In JavaScript standard modules, exports are read-only live bindings, so you do see changes to exported variables if you look at them after they've changed. I suggest further isolating the problem (factor out the library, for instance), so you know what to debug.