[英]Access serial port in web worker
I want to access the serial port navigator.serial.requestPort()
in web worker, but I get this error:我想访问 web worker 中的串口navigator.serial.requestPort()
,但是我得到这个错误:
Uncaught (in promise) TypeError: navigator.serial.requestPort is not a function未捕获(承诺)类型错误:navigator.serial.requestPort 不是 function
How can I fix this?我怎样才能解决这个问题?
You can't call requestPort from a worker, you'll need to call requestPort in the main application code then tell the worker to open the port.您不能从工作人员调用 requestPort,您需要在主应用程序代码中调用 requestPort 然后告诉工作人员打开端口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.