Class IdleDetector
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
NOTE
ExperimentalIdleDetector interface of the 'idle_detection_api' provides methods and events for detecting user activity on a device or screen.
[Value("IdleDetector")]
public class IdleDetector : EventTarget
- Inheritance
-
IdleDetector
- Inherited Members
Remarks
This interface requires a secure context.
Constructors
IdleDetector()
NOTE
ExperimentalIdleDetector() constructor creates a new IdleDetectorobject which provides events indicating when the user is no longer interacting
with their device or the screen has locked.
public IdleDetector()
Remarks
Properties
Onchange
[Value("onchange")]
public EventHandlerNonNull Onchange { get; set; }
Property Value
ScreenState
NOTE
ExperimentalscreenState read-only property of the IdleDetector interfacereturns a string indicating whether the screen is locked, one of
"locked" or"unlocked".
[Value("screenState")]
public ScreenIdleState? ScreenState { get; }
Property Value
- ScreenIdleState?
Either
"locked"or"unlocked"if Start(IdleOptions) has been called, ornullotherwise.
Remarks
UserState
NOTE
ExperimentaluserState read-only property of the IdleDetector interface returns a string indicating whether the user has interacted with the device since the call to start().
[Value("userState")]
public UserIdleState? UserState { get; }
Property Value
- UserIdleState?
Either
"active"or"idle"if Start(IdleOptions) has been called, ornullotherwise.
Remarks
Methods
RequestPermission()
NOTE
ExperimentalrequestPermission() static method of the IdleDetectorinterface returns a 'Promise' that resolves with a string when the user has chosen
whether to grant the origin access to their idle state. Resolves with
"granted" on acceptance and "denied" on refusal.
[Value("requestPermission")]
public static Task<PermissionState> RequestPermission()
Returns
- Task<PermissionState>
A
Promisethat resolves with"granted"or"denied".
Remarks
Start(IdleOptions)
NOTE
Experimentalstart() method of the IdleDetector interface returns aPromise that resolves when the detector starts listening for changes in the
user's idle state. This
method takes an optional
options object with the threshold in millisecondswhere inactivity should be reported and
signal for an AbortSignal to abortthe idle detector.
[Value("start")]
public Task<GlobalObject.Undefined> Start(IdleOptions options = null)
Parameters
optionsIdleOptions