| <h2 id="usage">Usage</h2> |
| |
| <p> |
| By default, |
| operating systems dim the screen when users are inactive |
| and eventually suspend the system. |
| With the power API, |
| an app or extension can keep the system awake. |
| </p> |
| |
| <p> |
| Using this API, |
| you can specify the |
| $(ref:Level) to which power management is disabled. |
| The <code>"system"</code> level keeps the system active, |
| but allows the screen to be dimmed or turned off. |
| For example, |
| a communication app can continue to receive messages |
| while the screen is off. |
| The <code>"display"</code> level keeps the screen and system active. |
| E-book and presentation apps, for example, |
| can keep the screen and system active |
| while users read. |
| </p> |
| |
| <p> |
| When a user has more than one app or extension active, |
| each with its own power level, |
| the highest-precedence level takes effect; |
| <code>"display"</code> always takes precedence |
| over <code>"system"</code>. |
| For example, |
| if app A asks for <code>"system"</code> power management, |
| and app B asks for <code>"display"</code>, |
| <code>"display"</code> is used until app B |
| is unloaded or releases its request. |
| If app A is still active, |
| <code>"system"</code> is then used. |
| </p> |