browser.runtime.sendMessage code example
Example 1: chrome.runtime.sendmessage
chrome.runtime.sendMessage({greeting: "hello"}, function(response) { console.log(response.farewell);});
Example 2: chrome.runtime.sendmessage
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { chrome.tabs.sendMessage(tabs[0].id, {greeting: "hello"}, function(response) { console.log(response.farewell); });});