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); |
Wladimir Palant
2016/03/21 11:59:40
IMHO, this shouldn't be necessary - each context (
Sebastian Noack
2016/03/21 13:26:02
If we would use window.chrome.runtime.onMessage un
Wladimir Palant
2016/03/21 13:58:01
I disagree. Current API requires developers to rem
Sebastian Noack
2016/03/21 15:26:59
Done.
|
} |
-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"); |
} |