Uh oh!
There was an error while loading. Please reload this page.
events: _events should be an own property - #2046
Closed
vkurchatkin wants to merge 1 commit into
Closed
Conversation
2c6b424 fixed this problem for the case where EventEmitter constructor is invoked. If is not, shared _events were still used. This commit ensures that listeners are added only to own _events. See: nodejs/node-v0.x-archive#7405
There was a problem hiding this comment.
ensureXxx function should not have a side-effect (no modified state).
I feel initializeXxx is better or remove side-effects like:
function ensureEvents(emitter) {
if (!emitter._events ||
emitter._events === Object.getPrototypeOf(emitter)._events) {
return false;
}
return true;
}
ContributorAuthor
There was a problem hiding this comment.
Disagree. ensure implies idempotency, nothing more
bnoordhuis
commented
Jun 24, 2015
Member
LGTM but maybe you can add a regression test for the two-level inheritance I described here? |
brendanashworth
commented
Sep 3, 2015
Contributor
Not sure about this. If it is incorrect, why should we support it? It isn't supported in any other inheritable node class and just leads to lots of annoying legacy code. |
jasnell
commented
Nov 16, 2015
Member
@vkurchatkin ... is this still something you'd like to pursue? |
vkurchatkin
commented
Nov 16, 2015
ContributorAuthor
@jasnell actually, no, I don't think it's a good idea anymore |
jasnell
commented
Nov 16, 2015
Member
Thanks @vkurchatkin ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#2044
R=@mscdex, @bnoordhuis