File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -68,13 +68,14 @@ class Serial extends EventTarget {
6868
6969 /**
7070 * Selects the appropriate protocol based on port path
71- * @param {string|null } portPath - Port path to determine protocol
71+ * @param {string|function| null } portPath - Port path or callback function for virtual mode
7272 */
7373 selectProtocol ( portPath ) {
7474 // Determine which protocol to use based on port path
75+ const isFn = typeof portPath === "function" ;
7576 const s = typeof portPath === "string" ? portPath : "" ;
7677 // Default to webserial for typical serial device identifiers.
77- if ( s === "virtual" ) {
78+ if ( isFn || s === "virtual" ) {
7879 return this . _protocols . find ( ( p ) => p . name === "virtual" ) ?. instance ;
7980 }
8081 if ( s === "manual" || / ^ ( t c p | w s | w s s ) : \/ \/ [ A - Z a - z 0 - 9 . - ] + (?: : \d + ) ? ( \/ .* ) ? $ / . test ( s ) ) {
You can’t perform that action at this time.
0 commit comments