Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/common.js

Issue 29723558: Issue 6482 - Use ES6 classes (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created March 15, 2018, 7:46 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld