Messages
Between Background and Content
Send Message
browser.runtime.sendMessage(payload); //send message
//send message and interact with response
chrome.runtime.sendMessage({type: "gid", "data": {....}}, (resp) => {
debug(resp);
});browser.tabs
.query({ active: true, currentWindow: true })
.then(tabs => browser.tabs.sendMessage(tabs[0].id, { type: C.toast }))
.then(resp => debug("Got response", resp))
.catch(_ => debug(browser.runtime.lastError.message));Listener
Message Passing Between Extensions
Send Message
Listener
From Webpages
Long lived Connections
Last updated