bare-events 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +12 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -61,48 +61,50 @@ module.exports = exports = class EventEmitter {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
addListener (name, fn) {
|
|
64
|
+
this.emit('newListener', name, fn)
|
|
64
65
|
const e = this._events[name] || (this._events[name] = new EventListener())
|
|
65
66
|
e.append(fn, false)
|
|
66
|
-
this
|
|
67
|
+
return this
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
addOnceListener (name, fn) {
|
|
71
|
+
this.emit('newListener', name, fn)
|
|
70
72
|
const e = this._events[name] || (this._events[name] = new EventListener())
|
|
71
73
|
e.append(fn, true)
|
|
72
|
-
this
|
|
74
|
+
return this
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
prependListener (name, fn) {
|
|
78
|
+
this.emit('newListener', name, fn)
|
|
76
79
|
const e = this._events[name] || (this._events[name] = new EventListener())
|
|
77
80
|
e.prepend(fn, false)
|
|
78
|
-
this
|
|
81
|
+
return this
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
prependOnceListener (name, fn) {
|
|
85
|
+
this.emit('newListener', name, fn)
|
|
82
86
|
const e = this._events[name] || (this._events[name] = new EventListener())
|
|
83
87
|
e.prepend(fn, true)
|
|
84
|
-
this
|
|
88
|
+
return this
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
removeListener (name, fn) {
|
|
88
92
|
const e = this._events[name]
|
|
89
93
|
if (e !== undefined) e.remove(fn)
|
|
90
94
|
this.emit('removeListener', name, fn)
|
|
95
|
+
return this
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
on (name, fn) {
|
|
94
|
-
this.addListener(name, fn)
|
|
95
|
-
return this
|
|
99
|
+
return this.addListener(name, fn)
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
once (name, fn) {
|
|
99
|
-
this.addOnceListener(name, fn)
|
|
100
|
-
return this
|
|
103
|
+
return this.addOnceListener(name, fn)
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
off (name, fn) {
|
|
104
|
-
this.removeListener(name, fn)
|
|
105
|
-
return this
|
|
107
|
+
return this.removeListener(name, fn)
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
emit (name, ...args) {
|