Skip to content

Instantly share code, notes, and snippets.

@nickytonline
Created September 16, 2018 23:32
Show Gist options
  • Save nickytonline/2c98f1ee4cf17f04a275b642b17c0683 to your computer and use it in GitHub Desktop.
Save nickytonline/2c98f1ee4cf17f04a275b642b17c0683 to your computer and use it in GitHub Desktop.
Chrome Extension Snippets
function getActiveTab() {
return new Promise((resolve, reject) => {
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
const activeTab = tabs.find(t => t.active);
resolve(activeTab);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment