Global Variables
These JavaScript variables can be used anywhere because these variables are defined in the window scope.
#
Predefined global variablesVariable | Description |
---|---|
NL_OS | Operating system name: Linux , Windows , or Darwin |
NL_ARCH | CPU architecture: x64 , arm , itanium , ia32 , or unknown |
NL_APPID | Application identifier |
NL_APPVERSION | Application version |
NL_PORT | Application port |
NL_MODE | Mode of the application: window , browser , cloud , or chrome |
NL_VERSION | Neutralinojs framework version |
NL_CVERSION | Neutralinojs client version |
NL_CWD | Current working directory |
NL_PATH | Application path |
NL_ARGS | Command-line arguments |
NL_PID | Identifier of the current process |
NL_RESMODE | Source of application resources: bundle or directory |
NL_EXTENABLED | Returns true if extensions are enabled |
NL_COMMIT | Framework binary's release commit hash |
NL_CCOMMIT | Client librar's release commit hash |
NL_CMETHODS | Custom method identifiers (Returns the same output that custom.getMethods returns). |
NL_WSAVSTLOADED | Returns true if the initial window state was loaded from the saved configuration |
tip
You can use NL_COMMIT
and NL_CCOMMIT
values to identify the codebase snapshot if you use nightly releases.
#
Custom global variablesYou can make custom global variables too via neutralino.config.json
, as shown
below.
The above custom global variable's value can be accessed with NL_TEST
. You can set any data type for
custom global variables. Look at the following examples.
Avoid overriding predefined global variables.