SuperNode
Foundation

system

System state APIs.

system.isDarkMode

Returns true when the current environment is using Dark Mode, otherwise returns false.

import { system } from "supernode";

if (await system.isDarkMode()) {
  console.log("Dark Mode")
} else {
  console.log("Light Mode")
}

system.getNetworkType

Returns the current network connection type.

ValueEnumDescription
0NetworkType.NoneNo available network
1NetworkType.WiFiWi-Fi
2NetworkType.CellularCellular data
3NetworkType.EthernetWired Ethernet
4NetworkType.OtherVirtual or other network
import { NetworkType, system } from "supernode";

const networkType = await system.getNetworkType();
if (networkType === NetworkType.WiFi) {
  console.log("Connected through Wi-Fi")
}

Reads a transport snapshot of the default active network. VPN returns Other; other multi-transport networks match Wi-Fi, cellular, then Ethernet. None means there is no active network or capability information. Use an actual request to check internet reachability.

On this page