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

Unified Diff: ext/background.js

Issue 29375899: Issue 4871 - Start using ESLint for adblockplusui (Closed)
Patch Set: Addressed Thomas' feedback Created March 7, 2017, 12:44 p.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 | « devtools-panel.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 88665eab3e936b3225131b706751a01eee9014d8..04476c447a2b7077fc69c52e55212be9401fd5ae 100644
--- a/ext/background.js
+++ b/ext/background.js
@@ -15,17 +15,18 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
-(function(global)
+"use strict";
+
{
- if (!global.ext)
- global.ext = {};
+ if (typeof ext == "undefined")
+ window.ext = {};
- window.addEventListener("load", function()
+ window.addEventListener("load", () =>
{
parent.postMessage({
type: "backgroundPageLoaded"
}, "*");
- }, false)
+ }, false);
function PageMap()
{
@@ -33,27 +34,27 @@
this._values = [];
}
PageMap.prototype = {
- keys: function()
+ keys()
{
- return this._keys.map(function(source)
+ return this._keys.map((source) =>
{
- return new global.ext.Page(source);
+ return new window.ext.Page(source);
});
},
- get: function(page)
+ get(page)
{
return this._values[this._keys.indexOf(page._source)];
},
- set: function(page, value)
+ set(page, value)
{
- var index = this._keys.indexOf(page._source);
+ let index = this._keys.indexOf(page._source);
if (index < 0)
{
index = this._keys.push(page._source) - 1;
- var callback = function()
+ let callback = function()
{
page._source.removeEventListener("unload", callback, false);
this.delete(page);
@@ -63,9 +64,9 @@
this._values[index] = value;
},
- delete: function(page)
+ delete(page)
{
- var index = this._keys.indexOf(page._source);
+ let index = this._keys.indexOf(page._source);
if (index >= 0)
{
this._keys.splice(index, 1);
@@ -74,9 +75,9 @@
}
};
- global.ext.PageMap = PageMap;
+ window.ext.PageMap = PageMap;
- global.ext.showOptions = function(callback)
+ window.ext.showOptions = function(callback)
{
if (top.location.href.indexOf("new-options.html") == -1)
window.open("new-options.html", "_blank");
@@ -85,11 +86,11 @@
callback();
};
- global.ext.devtools = {
+ window.ext.devtools = {
onCreated: {
- addListener: function(listener)
+ addListener(listener)
{
- window.addEventListener("message", function(event)
+ window.addEventListener("message", (event) =>
{
if (event.data.type == "devtools")
listener(new ext.Page(event.source));
@@ -97,4 +98,4 @@
}
}
};
-})(this);
+}
« no previous file with comments | « devtools-panel.js ('k') | ext/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld