MCPcopy Create free account
hub / github.com/GoogleChrome/samples / onWriteButtonClick

Function onWriteButtonClick

web-bluetooth/write-descriptor.js:52–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50}
51
52function onWriteButtonClick() {
53 if (!myDescriptor) {
54 return;
55 }
56 let encoder = new TextEncoder('utf-8');
57 let value = document.querySelector('#description').value;
58 log('Setting Characteristic User Description...');
59 myDescriptor.writeValue(encoder.encode(value))
60 .then(_ => {
61 log('> Characteristic User Description changed to: ' + value);
62 })
63 .catch(error => {
64 log('Argh! ' + error);
65 });
66}

Callers

nothing calls this directly

Calls 2

encodeMethod · 0.80
logFunction · 0.50

Tested by

no test coverage detected