Skip to content

Instantly share code, notes, and snippets.

@gtk2k
Created January 20, 2016 13:22
Show Gist options
  • Save gtk2k/60db4d808fd2eea1da73 to your computer and use it in GitHub Desktop.
Save gtk2k/60db4d808fd2eea1da73 to your computer and use it in GitHub Desktop.
chrome.tabs events
chrome.tabs.onCreated.addListener(function (tab) {
console.log('onCreated', tab);
});
chrome.tabs.onUpdated.addListener(function (tabId, inf) {
console.log('onUpdated', tabId, JSON.stringify(inf));
});
chrome.tabs.onMoved.addListener(function (tabId, inf) {
console.log('onMoved', tabId, JSON.stringify(inf));
});
chrome.tabs.onSelectionChanged.addListener(function (tabId, inf) {
console.log('onSelectionChanged', tabId, JSON.stringify(inf));
});
chrome.tabs.onActiveChanged.addListener(function (tabId, inf) {
console.log('onActiveChanged', tabId, JSON.stringify(inf));
});
chrome.tabs.onActivated.addListener(function (inf) {
console.log('onActivated', JSON.stringify(inf));
});
chrome.tabs.onHighlightChanged.addListener(function (inf) {
console.log('onHighlightChanged', JSON.stringify(inf));
});
chrome.tabs.onHighlighted.addListener(function (inf) {
console.log('onHighlighted', JSON.stringify(inf));
});
chrome.tabs.onDetached.addListener(function (tabId, inf) {
console.log('onDetached', tabId, JSON.stringify(inf));
});
chrome.tabs.onAttached.addListener(function (tabId, inf) {
console.log('onAttached', tabId, JSON.stringify(inf));
});
chrome.tabs.onRemoved.addListener(function (tabId, inf) {
console.log('onRemoved', tabId, inf.status);
});
chrome.tabs.onReplaced.addListener(function (tabId, inf) {
console.log('onReplaced', tabId, JSON.stringify(inf));
});
chrome.tabs.onZoomChange.addListener(function (tabId, inf) {
console.log('onZoomChange', tabId, JSON.stringify(inf));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment