diff --git a/README.md b/README.md index 2cceba97..3dafef2a 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,14 @@ # arduino-create-agent-js-client JS module providing discovery of the [Arduino Create Agent](https://github.com/arduino/arduino-create-agent) and communication with it + +## Changelog +[2.8.0] - 2022-03-21 + +### Added +- Added support (still in Beta) for Chrome's Web Serial API on ChromeOS. + Other operating systems should not be affected. + ## Installation ```bash diff --git a/demo/app.jsx b/demo/app.jsx index 92c6ba7d..1de7aa89 100644 --- a/demo/app.jsx +++ b/demo/app.jsx @@ -27,6 +27,8 @@ import V2 from './v2/v2.jsx'; const chromeExtensionID = 'hfejhkbipnickajaidoppbadcomekkde'; +const isChromeOs = () => window.navigator.userAgent.indexOf(' CrOS ') !== -1; + const scrollToBottom = (target) => { if (target) { target.scrollTop = target.scrollHeight; // eslint-disable-line no-param-reassign @@ -151,6 +153,17 @@ class App extends React.Component { } } + requestDevicePermission = () => { + if ('serial' in navigator) { + navigator.serial.requestPort([{ usbVendorId: 0x2341 }]).then((port) => { + daemon.devicesList.next({ + serial: [port], + network: [] + }); + }); + } + }; + showError(err) { this.setState({ error: err }); scrollToBottom(document.body); @@ -275,8 +288,10 @@ class App extends React.Component {
-

Connected Devices

- +
+

Connected Devices

+ { isChromeOs() && } +
serial: