Drafts defines a single global device object which provides access to information about the current device.
Example
// get system info from device object letmodel = device.model; letsystem = device.systemName; letosVersion = device.systemVersion; letbatteryLevel = device.batteryLevel;
// create and display it in an alert lets = "Model: " + model + "\n"; s = s + "System: " + system + "\n"; s = s + "OS: " + osVersion + "\n"; s = s + "Battery: " + batteryLevel; alert(s);
// branch logic based on platform if (device.systemName == 'macOS') { // do something only on Mac } else { // do something only on iOS }
Drafts defines a single global
device
object which provides access to information about the current device.Example