Skip to content

Instantly share code, notes, and snippets.

@groovecoder
Created May 10, 2017 19:39
Show Gist options
  • Select an option

  • Save groovecoder/db52cf7aea927124ba5fc571fdb33afd to your computer and use it in GitHub Desktop.

Select an option

Save groovecoder/db52cf7aea927124ba5fc571fdb33afd to your computer and use it in GitHub Desktop.
webExtension.startup().then(api => {
api.browser.runtime.onMessage.addListener((message, sender, sendReply) => {
if ("method" in message && methods.indexOf(message.method) !== -1) {
sendReply(this[message.method](message));
}
});
console.log("webExtension.startup.then(), reason: ", reason);
// Send "upgrade" message to WebExtension runtime
if (reason === "upgrade") {
console.log("sending upgrade message");
api.browser.runtime.sendMessage("upgrade").then(reply => {
console.log(reply);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment