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: Undo accidental whitespace change Created Jan. 16, 2017, 2:57 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"; 1 "use strict";
2 2
3 chrome.runtime.onMessage.addListener((message, sender, sendResponse) => 3 chrome.runtime.onMessage.addListener((message, sender, sendResponse) =>
4 { 4 {
5 return ext.onMessage._dispatch(message, {}, sendResponse).indexOf(true) != -1; 5 return ext.onMessage._dispatch(message, {}, sendResponse).indexOf(true) != -1;
6 }); 6 });
7 7
8 ext.onExtensionUnloaded = (() =>
Sebastian Noack 2017/01/16 15:35:55 The IFEE here existed originally to encapsulate th
kzar 2017/01/17 07:42:44 Done.
9 { 8 {
10 let port = null; 9 let port = null;
11 10
12 return { 11 ext.onExtensionUnloaded = {
13 addListener(listener) 12 addListener(listener)
14 { 13 {
15 if (!port) 14 if (!port)
16 port = chrome.runtime.connect(); 15 port = chrome.runtime.connect();
17 16
18 // When the extension is reloaded, disabled or uninstalled the 17 // When the extension is reloaded, disabled or uninstalled the
19 // background page dies and automatically disconnects all ports 18 // background page dies and automatically disconnects all ports
20 port.onDisconnect.addListener(listener); 19 port.onDisconnect.addListener(listener);
21 }, 20 },
22 removeListener(listener) 21 removeListener(listener)
23 { 22 {
24 if (port) 23 if (port)
25 { 24 {
26 port.onDisconnect.removeListener(listener); 25 port.onDisconnect.removeListener(listener);
27 26
28 if (!port.onDisconnect.hasListeners()) 27 if (!port.onDisconnect.hasListeners())
29 { 28 {
30 port.disconnect(); 29 port.disconnect();
31 port = null; 30 port = null;
32 } 31 }
33 } 32 }
34 } 33 }
35 }; 34 };
36 })(); 35 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld