I'm new to javascript so I apologies if this is obvious and everyone knows.
I'm using Message Passing to intruct the background.js of my Chrome Extension to perform an action when you press a button in the extensions popup.js
popup.js:
getCurrentTab(function(tab) {
chrome.runtime.sendMessage(
{type: 'status', tabId: tab.id },
function(response) {
console.log(response.message)
}
)
})
Background.js:
chrome.runtime.onMessage.addListener(
function(message, sender, callback) {
console.log("Received message" + message + ", " + sender + "," + callback)
alert('received')
callback({message: message.type});
})
I've already learned that i need to "Inspect" my popup window for it's console (where I can see the response being printed).
I can see the page is alerting, and I can see the response in my popups console. But the main pages console isn't being filled (with message starting "Received message").
Can someone help a poor js beginner out?