Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Add cd3 to toolbar and faster connections between background and content
Browse files Browse the repository at this point in the history
  • Loading branch information
andrenatal committed Nov 2, 2017
1 parent fa4c80f commit 5989b5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,17 @@ browser.browserAction.onClicked.addListener(function() {
});
creating.
then(tab => {
console.log(`Created new tab: ${tab.id}`);
setTimeout( function() {

const intervalConnection = setInterval( function() {
browser.tabs.sendMessage(
tab.id,
{msg: "background script syn"}
).then(response => {
console.log("Message from the content script", response.response);
clearInterval(intervalConnection);
}).catch(error => {
console.error(`Error: ${error}`);
//console.error(`Not connected yet. Retrying ${error}`);
});

}, 2000);
}, 100);

},
error => {
Expand Down
1 change: 1 addition & 0 deletions extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
}
}
browser.runtime.onMessage.addListener(request => {
metrics.start_session('toolbar');
SpeakToMePopup.showAt(0, 0);
stm_init();
return Promise.resolve({response: "content script ack"});
Expand Down

0 comments on commit 5989b5f

Please sign in to comment.