Index: ext/common.js |
=================================================================== |
--- a/ext/common.js |
+++ b/ext/common.js |
@@ -15,29 +15,33 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
"use strict"; |
{ |
window.ext = {}; |
- let EventTarget = ext._EventTarget = function() |
+ ext._EventTarget = class |
{ |
- this._listeners = new Set(); |
- }; |
- EventTarget.prototype = { |
+ constructor() |
+ { |
+ this._listeners = new Set(); |
+ } |
+ |
addListener(listener) |
{ |
this._listeners.add(listener); |
- }, |
+ } |
+ |
removeListener(listener) |
{ |
this._listeners.delete(listener); |
- }, |
+ } |
+ |
_dispatch(...args) |
{ |
let results = []; |
for (let listener of this._listeners) |
results.push(listener(...args)); |
return results; |