events: off: check context arg at last step
This commit is contained in:
parent
6e5f9ef0a2
commit
abdffc436f
1 changed files with 3 additions and 3 deletions
|
|
@ -87,6 +87,8 @@ module.exports = class EventEmitter {
|
|||
|
||||
if (index !== -1) {
|
||||
|
||||
if (context && context !== listener._context) return this
|
||||
|
||||
listeners.splice(index, 1)
|
||||
|
||||
// Custom event teardown
|
||||
|
|
@ -108,9 +110,7 @@ module.exports = class EventEmitter {
|
|||
|
||||
for (var i = listeners.length - 1; i !== -1; --i) {
|
||||
|
||||
if (context && context !== listeners[i]._context) continue
|
||||
|
||||
this.off(evt, listeners[i])
|
||||
this.off(evt, listeners[i], context)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue