Skip to content

Commit ee35bb0

Browse files
authored
chore: remove this alias in agent.js (#2671)
1 parent 82477d7 commit ee35bb0

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/agent.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,20 @@ class Agent extends DispatcherBase {
5454
this[kFactory] = factory
5555
this[kClients] = new Map()
5656

57-
const agent = this
58-
5957
this[kOnDrain] = (origin, targets) => {
60-
agent.emit('drain', origin, [agent, ...targets])
58+
this.emit('drain', origin, [this, ...targets])
6159
}
6260

6361
this[kOnConnect] = (origin, targets) => {
64-
agent.emit('connect', origin, [agent, ...targets])
62+
this.emit('connect', origin, [this, ...targets])
6563
}
6664

6765
this[kOnDisconnect] = (origin, targets, err) => {
68-
agent.emit('disconnect', origin, [agent, ...targets], err)
66+
this.emit('disconnect', origin, [this, ...targets], err)
6967
}
7068

7169
this[kOnConnectionError] = (origin, targets, err) => {
72-
agent.emit('connectionError', origin, [agent, ...targets], err)
70+
this.emit('connectionError', origin, [this, ...targets], err)
7371
}
7472
}
7573

0 commit comments

Comments
 (0)