IdleDetector: screenState property
Khả dụng hạn chế
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Note: This feature is available in Dedicated Web Workers.
Thuộc tính chỉ đọc screenState của giao diện IdleDetector trả về một chuỗi cho biết màn hình có bị khóa hay không, một trong hai giá trị "locked" hoặc "unlocked".
Giá trị
Một trong hai giá trị "locked" hoặc "unlocked" nếu IdleDetector.start() đã được gọi, hoặc null trong trường hợp ngược lại.
Ví dụ
Trong ví dụ dưới đây, callback change in trạng thái của userState và screenState ra console.
idleDetector.addEventListener("change", () => {
const userState = idleDetector.userState;
const screenState = idleDetector.screenState;
console.log(`Idle change: ${userState}, ${screenState}.`);
});
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| Idle Detection API> # api-idledetector-screenstate> |