-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
32 lines (32 loc) · 966 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Page Visibility API Demo</title>
</head>
<body>
<noscript>
<strong>We're sorry Page Visibility API Demo doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app" style="width: 80vw; margin:0 auto;font-size: 28px;padding: 20px;">
<p>Please open the browser console</p>
<p>Change the browser tab or minimal the browser.</p>
<p>See the output from console.</p>
</div>
<script src="/dist/index.umd.js"></script>
<script>
const IFPageVisible = window.IFPageVisible
IFPageVisible.observe(isVisible => {
if (isVisible) {
// show event
console.log("Browser's status is showing")
} else {
// hidden event
console.log("Browser's status is hide")
}
})
</script>
</body>
</html>