Skip to content

Commit

Permalink
fix(esl-event-listener): fix ESLEventTargetDecorator dispatched eve…
Browse files Browse the repository at this point in the history
…nt `target`
  • Loading branch information
ala-n committed Mar 9, 2023
1 parent 8538fe0 commit 8252988
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class ESLEventTargetDecorator<Args extends any[]> extends SyntheticEventT

if (!this.hasEventListener(event, 1)) {
const {target} = this;
ESLEventListener.subscribe(this, this.onEventDecorated, {event, target});
ESLEventListener.subscribe(this, this.createHandler(), {event, target});
}
}

Expand All @@ -71,8 +71,8 @@ export class ESLEventTargetDecorator<Args extends any[]> extends SyntheticEventT
}

/** @returns decorated handler */
protected get onEventDecorated(): EventListener {
return this.decorator(this.dispatchEvent.bind(this), ...this.params);
protected createHandler(): EventListener {
return this.decorator((event: Event) => this.dispatchEvent(event, this.target), ...this.params);
}
}

Expand Down

0 comments on commit 8252988

Please # to comment.