Global "magic" variables
Global "magic" variables
We define a few useful globally available variables:
-
DEV
— true when webpack is building in development modeif (__DEV__) { // we are running a dev build }
-
global.isAndroid
,ANDROID
— true when the platform is Androidif (global.isAndroid) { // we are running on android }
-
global.isIOS
,IOS
— true when the platform is iOSif (global.isIOS) { // we are running on iOS }
The following variables are also defined but are primarily intended to be used by NativeScript Core internally, or plugins that wish to use these.
-
NS_WEBPACK
— alwaystrue
when building with webpack -
NS_ENV_VERBOSE
—true
when--env.verbose
is set -
NS_DEV_HOST_IPS
— an array of IP addresses of the host machine (the machine running the build) when in development mode, and an empty array in production mode. -
CSS_PARSER
— the css parser used by NativeScript Core. The value is set based on the cssParser value in thenativescript.config.ts
and defaults tocss-tree
-
UI_USE_XML_PARSER
— a flag used by NativeScript Core to disable the XML parser when it’s not used -
UI_USE_EXTERNAL_RENDERER
— a flag used by NativeScript Core to disable registering global modules when an external renderer is used.