| // Copyright 2018 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // https://github.com/samuelgoto/idle-detection |
| |
| enum UserIdleState { |
| "active", |
| "idle" |
| }; |
| |
| enum ScreenIdleState { |
| "locked", |
| "unlocked" |
| }; |
| |
| [ |
| SecureContext, |
| Exposed=(Window,DedicatedWorker), |
| ActiveScriptWrappable, |
| RuntimeEnabled=IdleDetection |
| ] interface IdleDetector : EventTarget { |
| [CallWith=ScriptState] constructor(); |
| readonly attribute UserIdleState? userState; |
| readonly attribute ScreenIdleState? screenState; |
| attribute EventHandler onchange; |
| [Exposed=Window, CallWith=ScriptState, RaisesException, MeasureAs=IdleDetectionPermissionRequested] static Promise<PermissionState> requestPermission(); |
| [CallWith=ScriptState, RaisesException, MeasureAs=IdleDetectionStart] Promise<void> start(optional IdleOptions options = {}); |
| }; |