Skip to content

Commit

Permalink
chore: remove this alias in agent.js (nodejs#2671)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored and crysmags committed Feb 27, 2024
1 parent 49003db commit 41e001a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,20 @@ class Agent extends DispatcherBase {
this[kFactory] = factory
this[kClients] = new Map()

const agent = this

this[kOnDrain] = (origin, targets) => {
agent.emit('drain', origin, [agent, ...targets])
this.emit('drain', origin, [this, ...targets])
}

this[kOnConnect] = (origin, targets) => {
agent.emit('connect', origin, [agent, ...targets])
this.emit('connect', origin, [this, ...targets])
}

this[kOnDisconnect] = (origin, targets, err) => {
agent.emit('disconnect', origin, [agent, ...targets], err)
this.emit('disconnect', origin, [this, ...targets], err)
}

this[kOnConnectionError] = (origin, targets, err) => {
agent.emit('connectionError', origin, [agent, ...targets], err)
this.emit('connectionError', origin, [this, ...targets], err)
}
}

Expand Down

0 comments on commit 41e001a

Please sign in to comment.