chrome.system.powerSource

Description: The chrome.system.powerSource API allows Chrome Kiosk Apps to query the state of connected power sources.
Availability: Since Chrome 69.
Permissions: "system.powerSource"

Summary

Types
PowerSourceInfo
Methods
getPowerSourceInfo chrome.system.powerSource.getPowerSourceInfo(function callback)
requestStatusUpdate chrome.system.powerSource.requestStatusUpdate()
Events
onPowerChanged

Types

PowerSourceInfo

properties
enum of "unknown", "mains", or "usb" type

Type of power source.

unknown
Unspecified type.
mains
Dedicated charger. Typically single-purpose and non-USB (e.g. barrel jack plugs).
usb
USB charger, including both low-power Type-A chargers and high-power Type-C chargers using USB Power Delivery.
double (optional) maxPower

Maximum power this source is capable of delivering if known. Reported in watts, rounded to two significant digits.

boolean active

Whether this power source is connected to the device.

Methods

getPowerSourceInfo

chrome.system.powerSource.getPowerSourceInfo(function callback)

Requests information on attached power sources.

Parameters
function callback

The callback to invoke with the results or undefined if the power source information is not known.

The callback parameter should be a function that looks like this:

function(array of PowerSourceInfo powerSourceInfo) {...};
array of PowerSourceInfo (optional) powerSourceInfo

requestStatusUpdate

chrome.system.powerSource.requestStatusUpdate()

Requests a power source status update. Resulting power source status updates are observable using onPowerChanged.

Events

onPowerChanged

Event for changes in the set of connected power sources.

addListener

chrome.system.powerSource.onPowerChanged.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function(array of PowerSourceInfo powerSourceInfo) {...};
array of PowerSourceInfo powerSourceInfo