GLOBAL variables in MSFS JS files

Is there a way in MSFS to share a Global Variable between two JS files, in the same folder, without resorting to Lvars or Zvars

ie as what typically works in standard Javascript

file1.js:

var globalVar = ‘’, // The global variable

===================================

file2.js

var globalVar = require(./file1);

================

Maybe the file reference in the above is incorrect for the VFS ?

Afaik you can’t use require.

There’s a couple of other ways:

  • Temp storage variable save/retrieve using datastorage. Kind of like a semaphore.
  • Custom event messaging to pass the value between them
1 Like

Thanks @Sonicviz – I’ll stop wasting my time looking then …
:+1:

1 Like