Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
vladtreny authored Oct 1, 2021
1 parent c50326a commit d2e6777
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
20 changes: 20 additions & 0 deletions act.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Activation</title>
</head>
<body>
<script>
let cnt = 0;
let second = 0;
setInterval(()=>{
if (cnt++ === 50){
cnt = 0;
document.write('');
}
document.writeln(`${second++} second: UserActivation {hasBeenActive: ${navigator.userActivation.hasBeenActive}, isActive: ${navigator.userActivation.isActive}}<br/>`)
}, 1000);
</script>
</body>
</html>
33 changes: 33 additions & 0 deletions idle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Idle</title>
</head>
<body>
<script>
(async () => {
console.log('IdleDetector allows minimum 1 minute, so waiting.');

let cnt = 0;
let second = 0;
const controller = new AbortController();
const idleDetector = new IdleDetector();
idleDetector.addEventListener('change', () => {
if (cnt++ === 50) {
cnt = 0;
document.write('');
}
const userState = idleDetector.userState;
const screenState = idleDetector.screenState;
console.log(`userState: ${userState}, screenState: ${screenState}.`);
});

await idleDetector.start({
threshold: 60 * 1000,
});
})();

</script>
</body>
</html>

0 comments on commit d2e6777

Please sign in to comment.