-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht5m4r.html
More file actions
81 lines (71 loc) · 2.3 KB
/
t5m4r.html
File metadata and controls
81 lines (71 loc) · 2.3 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>T5M4R HUD</title>
<script src="get-devices.js"></script>
</head>
<body>
<h1>T5M4R HUP App</h1>
<p>Chrome advanced <a href="chrome://flags/#enable-web-bluetooth-new-permissions-backend">new permissions backend for Web Bluetooth</a> and <a href="chrome://flags/#enable-experimental-web-platform-features">Experimental Web Platform flag</a> are ENABLED.</p>
<h2>Model Overview</h2>
<p>
<button id="requestBluetoothDevice">Request Bluetooth Device</button>
</p>
<p>
<select id="devicesSelect"></select>
<button id="forgetBluetoothDevice">Forget Bluetooth Device</button>
</p>
<script>
var ChromeSamples = {
log: function() {
var line = Array.prototype.slice.call(arguments).map(function(argument) {
return typeof argument === 'string' ? argument : JSON.stringify(argument);
}).join(' ');
document.querySelector('#log').textContent += line + '\n';
},
clearLog: function() {
document.querySelector('#log').textContent = '';
},
setStatus: function(status) {
document.querySelector('#status').textContent = status;
},
setContent: function(newContent) {
var content = document.querySelector('#content');
while(content.hasChildNodes()) {
content.removeChild(content.lastChild);
}
content.appendChild(newContent);
}
};
</script>
<h3>Live Output</h3>
<div id="output" class="output">
<div id="content">Output area</div>
<div id="status"></div>
<pre id="log"></pre>
</div>
<script>
log = ChromeSamples.log;
function isWebBluetoothEnabled() {
if (navigator.bluetooth) {
return true;
} else {
ChromeSamples.setStatus('Web Bluetooth API is not available.\n' +
'Please make sure the "Experimental Web Platform features" flag is enabled.');
return false;
}
}
</script>
<script>
if (isWebBluetoothEnabled()) {
document.querySelector('#requestBluetoothDevice').addEventListener('click', function() {
onRequestBluetoothDeviceButtonClick();
});
document.querySelector('#forgetBluetoothDevice').addEventListener('click', function() {
onForgetBluetoothDeviceButtonClick();
});
}
</script>
</body>