Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Device

Drafts defines a single global device object which provides access to information about the current device.

Examples

// get system info from device object
var model = device.model;
var system = device.systemName;
var osVersion = device.systemVersion;
var batteryLevel = device.batteryLevel;

// create and display it in an alert
var s = "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 somethign only on iOS
}

Hierarchy

  • Device

Index

Properties

batteryLevel

batteryLevel: number

Current battery level as a number between 0.0 and 1.0

model

model: "iPhone" | "iPad" | "Mac"

Model of current device.

systemName

systemName: "iOS" | "macOS"

Name of current OS.

systemVersion

systemVersion: string

Version of current OS.

Generated using TypeDoc