FuseJS/Environment Module (JS)
The Environment API allows you to check which platform your app is currently running on.
You need to add a reference to "FuseJS"
in your project file to use this feature.
Examples
You can check which platform your app is running on using the following boolean properties:
var Environment = require('FuseJS/Environment');
if(Environment.ios) console.log("Running on iOS");
if(Environment.android) console.log("Running on Android");
if(Environment.preview) console.log("Running in preview mode");
if(Environment.mobile) console.log("Running on iOS or Android");
if(Environment.desktop) console.log("Running on desktop");
You can also get the version of the current mobile OS as a
human-readable string using the mobileOSVersion
property.
console.log(Environment.mobileOSVersion);
Note
On Android,
mobileOSVersion
returns Build.VERSION.RELEASE (e.g.1.0
or3.4b5
). On iOS, it returns a string in the format of<major>.<minor>.<patch>
(e.g.9.2.1
). Returns an empty string on all other platforms.
Location
- Namespace
- FuseJS
- Package
- FuseJS 2.9.1
Interface of Environment
Inherited from NativeModule
AddMember(NativeMember) uno
Reset : EventHandler (object, EventArgs) ux
Inherited from Module
Dispose uno
Evaluate(Context, ModuleResult) uno
Evaluate(Context, string) : ModuleResult uno
Evaluated : EventHandler (object, EventArgs) ux
EvaluateExports(Context, string) : object uno
GetFile : FileSource uno
Returns the file source that will be watched by the Context for changes in Fuse preview. Override in subclasses and return correct file source to support live updates in Fuse preview.