()
| 39 | } |
| 40 | |
| 41 | function onStopButtonClick() { |
| 42 | if (myCharacteristic) { |
| 43 | myCharacteristic.stopNotifications() |
| 44 | .then(_ => { |
| 45 | log('> Notifications stopped'); |
| 46 | myCharacteristic.removeEventListener('characteristicvaluechanged', |
| 47 | handleNotifications); |
| 48 | }) |
| 49 | .catch(error => { |
| 50 | log('Argh! ' + error); |
| 51 | }); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | function handleNotifications(event) { |
| 56 | let value = event.target.value; |