Advertisement
nagrizolich

Untitled

Oct 7th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. chrome.browserAction.onClicked.addListener(function(activeTab) {
  2.   var closedTabs = [];
  3.   chrome.tabs.query({}, function(tabs) {
  4.     for (var i = 0; i < tabs.length; i++) {
  5.       closedTabs.push(tabs[i]);
  6.       //chrome.tabs.remove(tabs[i].id);
  7.     }
  8.     chrome.tabs.create({
  9.       'url': chrome.extension.getURL('index.html')
  10.     }, function(newTab) {
  11.       chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
  12.           if (newTab.id === tabId && changeInfo.status == 'complete') {
  13.             chrome.runtime.sendMessage(closedTabs);
  14.           }
  15.       });
  16.     });
  17.   });
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement