This page contains documentation for advanced Fuse features, so we have taken the liberty to tick the "Show advanced things" checkbox above for you in advance to be able to provide you with some additional information.

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 or 3.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
Show Uno properties and methods

Interface of Environment

Inherited from NativeModule

Inherited from Module

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.

Inherited from object

Implemented Interfaces