File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
- import { Duplex } from 'readable-stream' ;
1
+ import { Duplex , DuplexOptions } from 'readable-stream' ;
2
2
import type { Runtime } from 'webextension-polyfill' ;
3
3
4
4
type Log = ( data : unknown , out : boolean ) => void ;
@@ -11,9 +11,13 @@ export default class PortDuplexStream extends Duplex {
11
11
/**
12
12
* @param port - An instance of WebExtensions Runtime.Port. See:
13
13
* {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port}
14
+ * @param streamOptions - stream options passed on to Duplex stream constructor
14
15
*/
15
- constructor ( port : Runtime . Port ) {
16
- super ( { objectMode : true } ) ;
16
+ constructor ( port : Runtime . Port , streamOptions : DuplexOptions = { } ) {
17
+ super ( {
18
+ objectMode : true ,
19
+ ...streamOptions ,
20
+ } ) ;
17
21
this . _port = port ;
18
22
this . _port . onMessage . addListener ( ( msg : unknown ) => this . _onMessage ( msg ) ) ;
19
23
this . _port . onDisconnect . addListener ( ( ) => this . _onDisconnect ( ) ) ;
You can’t perform that action at this time.
0 commit comments