- From: Kenneth Rohde Christiansen <notifications@github.com>
- Date: Wed, 06 Mar 2019 03:43:43 -0800
- To: w3ctag/design-reviews <design-reviews@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3ctag/design-reviews/issues/336/470077151@github.com>
Maybe something like (Maybe making threshold not optional to avoid polling?)
```webidl
[SecureContext, Exposed=Window, Constructor(IdleDetectorOptions options)
interface IdleDetector : EventTarget {
readonly attribute IdleState state;
readonly attribute DOMHighResTimeStamp? timestamp;
void start();
void stop();
attribute EventHandler onchange;
};
dictionary IdleDetectorOptions {
double threshold;
};
enum IdleState {
"active",
"idle",
"locked"
}
```
From your explainer it sounds like "locked" means that screen was turned off, and not a locked screen like WakeLock - those need to be aligned.
If you really need a one-shot you can add one like the geolocation sensor: https://www.w3.org/TR/geolocation-sensor/#idl-index
```webidl
[SecureContext, Exposed=Window, Constructor(IdleDetectorOptions options)
interface IdleDetector : EventTarget {
static Promise<IdleReading> read(optional ReadOptions readOptions);
readonly attribute DOMHighResTimeStamp? timestamp;
readonly attribute IdleState state;
void start();
void stop();
attribute EventHandler onchange;
};
dictionary IdleDetectorOptions {
double threshold;
};
dictionary ReadOptions : IdleDetectorOptions {
AbortSignal? signal;
};
enum IdleState {
"active",
"idle",
"locked"
}
ictionary IdleReading {
DOMHighResTimeStamp? timestamp;
readonly attribute IdleState state;
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/336#issuecomment-470077151
Received on Wednesday, 6 March 2019 11:44:05 UTC