We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b4b8ba5 commit 6f425cbCopy full SHA for 6f425cb
src/polyfill.ts
@@ -290,5 +290,8 @@ class Serial extends EventTarget {
290
}
291
292
293
-// @ts-ignore
294
-navigator.serial = new Serial()
+// copy functions instead of creating a new object,
+// so that references to navigator.serial are always valid
295
+const serial = new Serial()
296
+navigator.serial.getPorts = serial.getPorts.bind(serial)
297
+navigator.serial.requestPort = serial.requestPort.bind(serial)
0 commit comments