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

Unified Diff: ext/background.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: Use method shorthand Created Jan. 16, 2017, 4:07 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
« no previous file with comments | « composer.postload.js ('k') | ext/common.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ext/background.js
diff --git a/ext/background.js b/ext/background.js
index f6ce8ce075bae22f0569a1cdd741ee29646ba580..d8f67beff947da4193fdddaa5dd1a655ae5a4446 100644
--- a/ext/background.js
+++ b/ext/background.js
@@ -15,55 +15,56 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
-(function()
+"use strict";
+
{
- var nonEmptyPageMaps = Object.create(null);
- var pageMapCounter = 0;
+ let nonEmptyPageMaps = Object.create(null);
+ let pageMapCounter = 0;
- var PageMap = ext.PageMap = function()
+ let PageMap = ext.PageMap = function()
{
this._map = Object.create(null);
this._id = ++pageMapCounter;
};
PageMap.prototype = {
- _delete: function(id)
+ _delete(id)
{
delete this._map[id];
if (Object.keys(this._map).length == 0)
delete nonEmptyPageMaps[this._id];
},
- keys: function()
+ keys()
{
return Object.keys(this._map).map(ext.getPage);
},
- get: function(page)
+ get(page)
{
return this._map[page.id];
},
- set: function(page, value)
+ set(page, value)
{
this._map[page.id] = value;
nonEmptyPageMaps[this._id] = this;
},
- has: function(page)
+ has(page)
{
return page.id in this._map;
},
- clear: function()
+ clear()
{
- for (var id in this._map)
+ for (let id in this._map)
this._delete(id);
},
- delete: function(page)
+ delete(page)
{
this._delete(page.id);
}
};
- ext._removeFromAllPageMaps = function(pageId)
+ ext._removeFromAllPageMaps = pageId =>
{
- for (var pageMapId in nonEmptyPageMaps)
+ for (let pageMapId in nonEmptyPageMaps)
nonEmptyPageMaps[pageMapId]._delete(pageId);
};
-})();
+}
« no previous file with comments | « composer.postload.js ('k') | ext/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld