3 window
.onmessage
= messageEvent
=> {
4 if (messageEvent
.data
=== 'Go') {
5 navigator
.bluetooth
.requestDevice({
6 filters
: [{services
: ['generic_access']}]
8 if (device
.constructor.name
=== "BluetoothDevice") {
9 parent
.postMessage('Success', '*');
11 parent
.postMessage('FAIL: requestDevice in iframe returned ' + device
, '*');
15 parent
.postMessage('FAIL: ' + err
, '*');
19 parent
.postMessage("Ready", "*");