summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/idle/idle_detector.idl
blob: e582e0ca4f1cd28d7cf5fc93897aadcafa83b521 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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 = {});
};