在 Angular 中实现 Navigator.serial

saf*_*one 6 serial-port interface navigator angular webapi

我遇到的问题是,在我的 Angular 应用程序中, 类型“Navigator”上不存在错误属性“序列”。 得到。

https://stackblitz.com/edit/angular-ivy-kf19n7?file=src/app/app.component.ts

该应用程序在本地模式下运行。要修复此错误,我必须将串行集成到导航器界面中。

https://wicg.github.io/serial/

有人可以帮我怎么做吗?

不幸的是我的尝试显示错误

interface Navigator extends MSFileSaver,..... {

readonly Serial: serial; }
Run Code Online (Sandbox Code Playgroud)

谢谢 :)

编辑:已解决

我编辑了 Stackblitz 文件。

小智 5

navigator.serial 的类型信息可从 DefinelyTyped 中作为dom-serial获得

npm install --save-dev @types/dom-serial
Run Code Online (Sandbox Code Playgroud)