summaryrefslogtreecommitdiff
path: root/lib/events.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events.js')
-rw-r--r--lib/events.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/events.js b/lib/events.js
index 1414a1429d..c7bd15dc5b 100644
--- a/lib/events.js
+++ b/lib/events.js
@@ -280,13 +280,11 @@ function _addListener(target, type, listener, prepend) {
// Adding the second element, need to change to array.
existing = events[type] =
prepend ? [listener, existing] : [existing, listener];
- } else {
// If we've already got an array, just append.
- if (prepend) {
- existing.unshift(listener);
- } else {
- existing.push(listener);
- }
+ } else if (prepend) {
+ existing.unshift(listener);
+ } else {
+ existing.push(listener);
}
// Check for listener leak