Last active
March 22, 2016 06:27
-
-
Save greatghoul/be64f7464ae2b0869f25 to your computer and use it in GitHub Desktop.
an extension tha each time I close a tab a new one open - https://redd.it/49j7h5
This file contains 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
const mappings = {}; | |
chrome.tabs.onCreated.addListener((tab) => { | |
mappings[tab.id] = tab.url; | |
}); | |
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { | |
mappings[tabId] = tab.url; | |
}); | |
chrome.tabs.onRemoved.addListener((tabId, removeInfo) => { | |
const url = mappings[tabId] | |
console.log(`Closing ${url}`); | |
if (url != 'chrome://newtab/') { | |
chrome.tabs.create({}); | |
} | |
}); |
This file contains 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
{ | |
"manifest_version": 2, | |
"name": "Keep Tab", | |
"version": "0.1", | |
"description": "an extension tha each time I close a tab a new one open - https://redd.it/49j7h5", | |
"background": { | |
"scripts": ["event.js"], | |
"persistent": true | |
}, | |
"permissions": ["tabs"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment