Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node/events): align EventEmitter#addListener with native node tests #976

Merged
merged 1 commit into from
Jun 21, 2021

Conversation

uki00a
Copy link
Contributor

@uki00a uki00a commented Jun 17, 2021

Part of #911

Changes

  • Enabled test-event-emitter-add-listeners.js
  • The newListener event is now emitted with an unwrapped listener
  • EventEmitter#addListener now points to the same function as EventEmitter#on

): this {
return this._addListener(eventName, listener, false);
// The body of this method is empty because it will be overwritten by later code. (`EventEmitter.prototype.addListener = EventEmitter.prototype.on;`)
// The purpose of this dirty hack is to get around the current limitation of TypeScript type checking.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

const listeners_new_listener_emitted = [];

// Sanity check
assert.strictEqual(ee.addListener, ee.on);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uki00a LGTM. Thanks!

@kt3k kt3k merged commit fbbad97 into denoland:main Jun 21, 2021
@uki00a uki00a deleted the fix-EventEmitter#addListener branch June 21, 2021 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants