Commit 3b2abbcc authored by ronald's avatar ronald

Update message passing between popup and background

parent 048dffe2
......@@ -7,6 +7,12 @@ inputButton.onclick = function(element) {
console.log("hi");
var text = document.querySelector("textarea").value.trim().split('\n');
idArray = text.join(',');
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.storage.local.set({idArray : idArray}, function () {
console.log("set storage");
});
chrome.runtime.sendMessage("Message sent");
});
}
toGoogle.onclick = function(element) {
......@@ -16,13 +22,13 @@ toGoogle.onclick = function(element) {
});
};
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if(changeInfo.url) {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.storage.local.set({idArray : idArray}, function () {
console.log("set storage");
});
chrome.runtime.sendMessage(null);
});
}
});
\ No newline at end of file
// chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
// if(changeInfo.url) {
// chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
// chrome.storage.local.set({idArray : idArray}, function () {
// console.log("set storage");
// });
// chrome.runtime.sendMessage(null);
// });
// }
// });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment