Created
November 24, 2015 02:42
-
-
Save citylims/050e18621dc9dd923411 to your computer and use it in GitHub Desktop.
Semantics with google chrome api
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
//execute my jquery script in chrome tabs; | |
//execute my content script in the chorme tabs; | |
chrome.tabs.executeScript({ file: "jquery.min.js" }, function() { | |
chrome.tabs.executeScript({ file: "scripts/content.js" }); | |
}); | |
//when a new chrome tab is created run my function; | |
chrome.tabs.onCreated.addListener(function(tabId, changeInfo, tab) { | |
refeshScript(); | |
}); | |
//when a chrome tab becomes active; | |
//run my function on that tab; | |
chrome.tabs.onActivated.addListener(function(activeTab) { | |
chrome.tabs.get(activeTab.tabId, function () { | |
refreshScript(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment