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

Delta Between Two Patch Sets: chrome/ext/content.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Left Patch Set: Created Jan. 13, 2017, 12:11 p.m.
Right Patch Set: Addressed some more feedback Created Jan. 18, 2017, 11:44 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « chrome/ext/common.js ('k') | chrome/ext/devtools.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 "use strict";
2
1 chrome.runtime.onMessage.addListener((message, sender, sendResponse) => 3 chrome.runtime.onMessage.addListener((message, sender, sendResponse) =>
2 { 4 {
3 return ext.onMessage._dispatch(message, {}, sendResponse).indexOf(true) != -1; 5 return ext.onMessage._dispatch(message, {}, sendResponse).indexOf(true) != -1;
4 }); 6 });
5 7
6 ext.onExtensionUnloaded = (() =>
7 { 8 {
8 let port = null; 9 let port = null;
9 10
10 return { 11 ext.onExtensionUnloaded = {
11 addListener: listener => 12 addListener(listener)
12 { 13 {
13 if (!port) 14 if (!port)
14 port = chrome.runtime.connect(); 15 port = chrome.runtime.connect();
15 16
16 // When the extension is reloaded, disabled or uninstalled the 17 // When the extension is reloaded, disabled or uninstalled the
17 // background page dies and automatically disconnects all ports 18 // background page dies and automatically disconnects all ports
18 port.onDisconnect.addListener(listener); 19 port.onDisconnect.addListener(listener);
19 }, 20 },
20 removeListener: listener => 21 removeListener(listener)
21 { 22 {
22 if (port) 23 if (port)
23 { 24 {
24 port.onDisconnect.removeListener(listener); 25 port.onDisconnect.removeListener(listener);
25 26
26 if (!port.onDisconnect.hasListeners()) 27 if (!port.onDisconnect.hasListeners())
27 { 28 {
28 port.disconnect(); 29 port.disconnect();
29 port = null; 30 port = null;
30 } 31 }
31 } 32 }
32 } 33 }
33 }; 34 };
34 })(); 35 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld