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

Unified Diff: popup.js

Issue 29338491: Issue 3823 - Split up message responder code (Closed)
Patch Set: Don't check for instance of Promise, avoid creating unnecessary arays Created March 21, 2016, 1:25 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 | « metadata.common ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: popup.js
===================================================================
--- a/popup.js
+++ b/popup.js
@@ -23,6 +23,7 @@
var Prefs = require("prefs").Prefs;
var checkWhitelisted = require("whitelisting").checkWhitelisted;
var getDecodedHostname = require("url").getDecodedHostname;
+var port = require("messaging").port;
var page = null;
@@ -57,7 +58,7 @@
});
// Attach event listeners
- ext.onMessage.addListener(onMessage);
+ port.on("composer.ready", onComposerReady);
document.getElementById("enabled").addEventListener("click", toggleEnabled, false);
document.getElementById("clickhide").addEventListener("click", activateClickHide, false);
document.getElementById("clickhide-cancel").addEventListener("click", cancelClickHide, false);
@@ -79,12 +80,12 @@
function onUnload()
{
- ext.onMessage.removeListener(onMessage);
+ port.off("composer.ready", onComposerReady);
}
-function onMessage(message, sender, callback)
+function onComposerReady(message, sender)
{
- if (message.type == "composer.ready" && sender.page.id == page.id)
+ if (sender.page.id == page.id)
document.body.classList.remove("nohtml");
}
« no previous file with comments | « metadata.common ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld