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.
| Value | Enum | Description |
|---|---|---|
0 | NetworkType.None | No available network |
1 | NetworkType.WiFi | Wi-Fi |
2 | NetworkType.Cellular | Cellular data |
3 | NetworkType.Ethernet | Wired Ethernet |
4 | NetworkType.Other | Virtual 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.