chromium/third_party/blink/renderer/modules/idle/idle_detector.idl

// Copyright 2018 The Chromium Authors
// 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
] 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<undefined> start(optional IdleOptions options = {});
};