File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -39,18 +39,35 @@ class Dispatcher extends EventEmitter {
3939 }
4040}
4141
42+ const kOnDrain = Symbol ( 'onDrain' )
43+ const kOnConnect = Symbol ( 'onConnect' )
44+ const kOnDisconnect = Symbol ( 'onDisconnect' )
45+ const kOnConnectionError = Symbol ( 'onConnectionError' )
46+
4247class ComposedDispatcher extends Dispatcher {
43- #dispatcher = null
44- #dispatch = null
48+ #dispatcher
49+ #dispatch
4550
4651 constructor ( dispatcher , dispatch ) {
4752 super ( )
53+
4854 this . #dispatcher = dispatcher
4955 this . #dispatch = dispatch
56+
57+ this [ kOnDrain ] = ( ) => this . emit ( 'drain' )
58+ this [ kOnConnect ] = ( ) => this . emit ( 'connect' )
59+ this [ kOnDisconnect ] = ( ) => this . emit ( 'disconnect' )
60+ this [ kOnConnectionError ] = ( ) => this . emit ( 'connectionError' )
61+
62+ this . #dispatcher
63+ . on ( 'drain' , this [ kOnDrain ] )
64+ . on ( 'connect' , this [ kOnConnect ] )
65+ . on ( 'disconnect' , this [ kOnDisconnect ] )
66+ . on ( 'connectionError' , this [ kOnConnectionError ] )
5067 }
5168
5269 dispatch ( ...args ) {
53- this . #dispatch( ...args )
70+ return this . #dispatch( ...args )
5471 }
5572
5673 close ( ...args ) {
You can’t perform that action at this time.
0 commit comments