Skip to content

Commit 345d045

Browse files
committed
implement RAIIEventEmitter.discard and free generic listeners
1 parent 9efad52 commit 345d045

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/RAIIEventEmitter.qml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ EventEmitter {
55
this._onListener = {}
66
}
77

8+
function discard() {
9+
var listeners = this._onListener
10+
for(var name in listeners) {
11+
this.removeAllListeners(name)
12+
}
13+
$core.EventEmitter.prototype.discard.call(this)
14+
}
15+
816
///@private
917
function on (name, callback) {
1018
if (!(name in this._eventHandlers)) {

0 commit comments

Comments
 (0)