Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
78162b5d
...
78162b5d8e8904b96dc09c9887cffada79bc711d
authored
2014-05-17 13:07:10 +0200
by
Christophe Porteneuve
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Refs #687 -- ACTUALLY fixes the issue :-) by special-casing 'fail' events for prepending
1 parent
e14544ab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
modules/events.js
modules/events.js
View file @
78162b5
...
...
@@ -129,7 +129,7 @@ EventEmitter.prototype.addListener = function addListener(type, listener) {
}
else
if
(
isArray
(
this
.
_events
[
type
]))
{
// If we've already got an array, just append.
this
.
_events
[
type
]
.
push
(
listener
);
this
.
_events
[
type
]
[
'fail'
===
type
?
'unshift'
:
'push'
]
(
listener
);
// Check for listener leak
if
(
!
this
.
_events
[
type
].
warned
)
{
...
...
@@ -151,7 +151,7 @@ EventEmitter.prototype.addListener = function addListener(type, listener) {
}
}
else
{
// Adding the second element, need to change to array.
this
.
_events
[
type
]
=
[
this
.
_events
[
type
],
listener
];
this
.
_events
[
type
]
=
'fail'
===
type
?
[
listener
,
this
.
_events
[
type
]]
:
[
this
.
_events
[
type
],
listener
];
}
return
this
;
...
...
Please
register
or
sign in
to post a comment