Created
May 10, 2017 19:42
-
-
Save groovecoder/fc2f54ac64d1a5bcee9c94db68174063 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // WebExtension startup | |
| 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); | |
| }); | |
| } | |
| this.registerBackgroundConnection(api); | |
| }).catch(e => { | |
| throw new Error("WebExtension startup failed. Unable to continue. ", e); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment