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

Unified Diff: js/desktop-options.js

Issue 29715759: Issue 6440 - Use long-lived connections to listen to extension events (Closed)
Patch Set: Use less generic name for only listener argument we care about Created March 7, 2018, 2:01 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
Index: js/desktop-options.js
===================================================================
--- a/js/desktop-options.js
+++ b/js/desktop-options.js
@@ -1419,7 +1419,9 @@
}
}
-ext.onMessage.addListener((message) =>
+let port = browser.runtime.connect({name: "ui"});
+
+port.onMessage.addListener((message) =>
{
switch (message.type)
{
@@ -1450,21 +1452,21 @@
}
});
-browser.runtime.sendMessage({
+port.postMessage({
type: "app.listen",
filter: ["addSubscription", "focusSection"]
});
-browser.runtime.sendMessage({
+port.postMessage({
type: "filters.listen",
filter: ["added", "loaded", "removed"]
});
-browser.runtime.sendMessage({
+port.postMessage({
type: "prefs.listen",
filter: ["notifications_ignoredcategories", "notifications_showui",
"show_devtools_panel", "shouldShowBlockElementMenu",
"ui_warn_tracking"]
});
-browser.runtime.sendMessage({
+port.postMessage({
type: "subscriptions.listen",
filter: ["added", "disabled", "homepage", "lastDownload", "removed",
"title", "downloadStatus", "downloading"]

Powered by Google App Engine
This is Rietveld