global variable

The best way to create a global variable.

1 : App.variable

2 :

Which is the best way?

You know there is no single answer to that. :slight_smile:

Heres an idea: if there are a few, use app property
If there are many and they can be grouped, you could use several modules to separate the groupings.

Or perhaps one or more classes used as singletons.

For a true global variable, you would put it in a module since then you can call the variable directly.

I select the module.

The best way to create a global variable is to first stop and ask yourself, “Should I create a global variable?” Repeat until the answer is “yes” only one out of every 100 times. :slight_smile: