Trigger.io

Trigger.io Forge Documentation

Important

This documentation is deprecated, and only kept here to support users of browser extension APIs. If you are using Trigger.io for iOS or Android, see https://trigger.io/docs/.

is: Platform Detection

Forge allows you to build cross-platform mobile apps and browser extensions from the same code. Sometimes it may be necessary to do a specific action based on the platform that is running the code. The following methods allow you to determine what platform that is.

Config

The is module must be enabled in config.json

{
    "modules": {
        "is": true
    }
}

API

API

mobile

is.mobile()
Return boolean:Returns true if running on a mobile device

desktop

is.desktop()
Return boolean:Returns true if running on a desktop/laptop computer

web

is.web()
Return boolean:Returns true if running on as a hosted web app

android

is.android()
Return boolean:Returns true if running on an Android device

ios

is.ios()
Return boolean:Returns true if running on an IOS device

chrome

is.chrome()
Return boolean:Returns true if running on Chrome browser

firefox

is.firefox()
Return boolean:Returns true if running on Firefox browser

safari

is.safari()
Return boolean:Returns true if running on Safari browser

ie

is.ie()
Return boolean:Returns true if running on IE browser

orientation

Platforms: Mobile

portrait

is.orientation.portrait()
Return boolean:Returns true if a mobile device has a portrait orientation

landscape

is.orientation.landscape()
Return boolean:Returns true if a mobile device has a landscape orientation

connection

Platforms: Mobile

Note

These functions are not reliable during your app's initialisation: you should use connectionStateChange.addListener. We guarantee to fire that event as the app starts up.

connected

is.connection.connected()
Return boolean:Returns true if a mobile device has an active internet connection.

wifi

is.connection.wifi()
Return boolean:Returns true if a mobile device is connected via wifi.