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

Unified Diff: chrome/ext/content.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: Addressed feedback, used destructuring Created Jan. 17, 2017, 7:39 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 | « chrome/ext/common.js ('k') | chrome/ext/devtools.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/ext/content.js
diff --git a/chrome/ext/content.js b/chrome/ext/content.js
index b54fdcfb0c9f568738704a7587554dfce14949d8..bde266392fe4e40114177ee485c5f5b7696c4a62 100644
--- a/chrome/ext/content.js
+++ b/chrome/ext/content.js
@@ -1,14 +1,15 @@
-chrome.runtime.onMessage.addListener(function(message, sender, sendResponse)
+"use strict";
+
+chrome.runtime.onMessage.addListener((message, sender, sendResponse) =>
{
return ext.onMessage._dispatch(message, {}, sendResponse).indexOf(true) != -1;
});
-ext.onExtensionUnloaded = (function()
{
- var port = null;
+ let port = null;
- return {
- addListener: function(listener)
+ ext.onExtensionUnloaded = {
+ addListener(listener)
{
if (!port)
port = chrome.runtime.connect();
@@ -17,7 +18,7 @@ ext.onExtensionUnloaded = (function()
// background page dies and automatically disconnects all ports
port.onDisconnect.addListener(listener);
},
- removeListener: function(listener)
+ removeListener(listener)
{
if (port)
{
@@ -31,4 +32,4 @@ ext.onExtensionUnloaded = (function()
}
}
};
-})();
+}
« no previous file with comments | « chrome/ext/common.js ('k') | chrome/ext/devtools.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld