The Platform info object returns information about the system, device and browser.
Platform info conditions
- Is Cordova export
- True when running after a Cordova-based export. Cordova is used to export Android and iOS apps, and implies that the platform is mobile and the OS is either Android or iOS.
- Is NW.js export
- True when running after an NW.js export.
- Is web export
- True when running after a web-based export. This is also true in preview mode, so that any features based on these export conditions will act as if it's in a web-based export in preview mode.
- Is Windows UWP export
- True when running after a Windows UWP export. The Universal Windows Platform (UWP) is used for apps in the Microsoft Store and publishing to Xbox One.
- On network change
- Triggered when the network connection changes, e.g. when moving from a Wifi network to a cellular data network. The network-related expressions will update in this trigger to reflect values for the new network.
- Is on Android
- Is on Chrome OS
- Is on iOS
- Is on Linux
- Is on macOS
- Is on Windows
- These conditions check which operating system (OS) the project is currently running on. For example in Chrome on Windows, Is on Windows will be true; in an Android app, Is on Android will be true; and so on. Note these conditions are not exhaustive: there may be platforms where none of these six conditions are true.
- Is on mobile
- Test if the current operating system is classed as mobile, i.e. a phone or tablet. The detection may not always be accurate, but should always be true on iOS and Android, and false on Windows, macOS, Linux and Chrome OS.
- Is wake lock active
- True if a Request wake lock action has successfully completed and the screen is currently being kept on.
- Is wake lock supported
- True if the current browser/platform supports using wake locks to keep the screen on.
- On wake lock acquired
- Triggered after the Request wake lock action if the lock was successfully acquired. The screen will be kept on until On wake lock released triggers.
- On wake lock error
- Triggered if an error occurs while attempting to request a wake lock. The screen will not be kept on.
- On wake lock released
- Triggered when an existing wake lock is released, meaning the screen may once again automatically turn off due to inactivity. This can happen after a Release wake lock action, or automatically in some circumstances, such as if the browser tab or app goes in to the background. To keep the screen on after this trigger, another wake lock must be requested.
Platform info actions
- Request wake lock
- Request a wake lock to keep the screen on permanently, preventing it automatically dimming or switching off due to inactivity. Note this increases power usage so will drain battery more quickly. If successful, On wake lock acquired triggers; otherwise On wake lock error triggers.
- Release wake lock
- If a wake lock is currently active, release it, so the screen may once again dim or turn off due to inactivity.
Platform info expressions
- Return the approximate amount of device memory (RAM) in gigabytes. For privacy reasons some platforms will round the result, so it may not match the exact amount installed on the system. Additionally this value is not available on some browsers or platforms, in which case it will return 0.
- Return the number of hardware threads supported by the CPU. This is normally at least the number of CPU cores. Many modern CPUs support multiple hardware threads on a single CPU (e.g. Hyper-threading), and a common case is for each CPU to support two hardware threads, so this is often double the number of CPU cores. For privacy reasons some platforms will round the result, so it may not match the exact number of hardware threads/CPU cores available on the system. If the value is not available, it will return 0. However almost all consumer devices have at least two CPU cores.
- Return the size of the main display canvas in CSS pixels. This does not correspond exactly to device (physical display) pixels, but is the appropriate size from a web design perspective in
- Return the size of the main display canvas in device (physical display) pixels. Unlike the CSS size, this size reflects the number of actual pixels used in the display.
- Return the number of device (physical display) pixels per CSS pixel. For example a high-DPI display may have a device pixel ratio of 2, meaning there are two device pixels per CSS pixel. This value also reflects the browser zoom level, which works by adjusting the device pixel ratio. The concept of the device pixel ratio also allows web pages using
px units to appear the same size on higher density displays where physical pixels are much smaller.
- Return a string indicating the graphics rendering technology in use. This can be either
"webgl2". It can also have a
-software suffix if a "major performance caveat" is detected, which is a WebGL flag that normally indicates slower software rendering, typically due to unreliable GPU drivers. For example, software-rendered WebGL 1 support would return
- Return a string describing system-specific detail about the graphics hardware in use. This typically describes the GPU manufacturer and model name, and sometimes some hardware capabilities.
- The inset around the edges of the screen in CSS pixels of a rectangular area that is always visible (hence safe to use for displaying anything important without it risking being cut off). This only applies for devices with non-rectangular screens, notably mobile devices with a notch, or in some cases devices with rounded edges in the corners of the screen. Devices with a standard rectangular display will return 0 for these values.
- Get the size of the current display screen. Note this often includes areas not available to applications, such as a desktop taskbar, or mobile status bar.
- Get the inner size of the current window. This is the size of the window content area that is available to the application.
- Get the outer size of the current window. This includes the window browser, caption, browser address bar etc. which is not generally available to the application.
- Return a string rating the effective type of the connection based on the comparable cellular data connection generation, e.g.
- Return the estimated round-trip time (latency) of the connection in milliseconds. This is the time it takes for a network message to be sent to the remote host and a reply to be received back.
- The type of network connection technology in use, e.g.
"ethernet". If the connection type cannot be detected or the platform does not support this feature, returns
- The estimated effective download bandwidth in megabits per second. Returns 0 if unable to detect.
- The maximum downlink speed in megabits per second of the underlying connection technology. This is normally the theoretical maximum the current network technology's specification allows, for example 4G cellular allows a higher maximum speed than 3G under ideal signal conditions; however the actual available bandwidth will depend on other factors like signal quality and other parts of the network. Returns 0 if unable to detect.
Construct 3 Manual
You are here:
Search this manual:
This manual entry was last updated on 4 Aug, 2020 at 14:39