Skip to main content

Module runtime

Module runtime 

Source
Expand description

Provides functions that allow to detect the runtime environment. These functions can be used to detect whether the code is running in a browser, node.js or native OS, the type of the underlying OS (Windows,Linux,MacOS,*BSD) as well as the type of a web environment (Browser or NWJS). This is useful for an application of an API to detect which environment it is operating under and subsequently restrict the functionality to the capabilities to this environment.

Enums§

Platform
Operating system / platform on which the application is running.
Runtime
application runtime info

Functions§

is_android
Returns true if the current platform is Android.
is_chrome_extension
Returns true if the application is running as a Chrome browser extension.
is_cross_origin_isolated
Helper to test whether the application is running in a cross-origin isolated browser environment (Flutter).
is_electron
Helper to test whether the application is running under Electron.
is_electron_client
Helper to test whether the application is running under Electron backend.
is_electron_server
Helper to test whether the application is running under Electron backend.
is_freebsd
Returns true if the current platform is FreeBSD.
is_ios
Returns true if the current platform is iOS.
is_linux
Returns true if the current platform is Linux.
is_macos
Returns true if the current platform is macOS.
is_mobile
Returns true if the current platform is a mobile OS (iOS or Android).
is_native
Helper to test whether the application is running under native runtime which is not a Solana OS and architecture is not WASM32
is_netbsd
Returns true if the current platform is NetBSD.
is_node
Helper to test whether the application is running under NodeJs-compatible environment.
is_nw
Helper to test whether the application is running under NW environment.
is_openbsd
Returns true if the current platform is OpenBSD.
is_solana
Helper to test whether the application is running under Solana OS.
is_unix
Returns true if the current platform is a Unix-like OS (macOS, Linux, or a BSD).
is_wasm
Helper to test (at runtime) whether the application is running under WASM32 architecture.
is_web
Helper to test whether the application is running under in a regular browser environment.
is_web_capable
Identifies web-capable environment (browser, NWJS window, Electron client)
is_windows
Returns true if the current platform is Windows.
platform
Detects and returns the Platform the application is running on, caching the result on first call.