Created
December 30, 2015 09:32
-
-
Save harishvc/a1b3dad9be5c40cac484 to your computer and use it in GitHub Desktop.
mapit - background.js (active and inactive tab)
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
var match = 'https://calendar.google.com/calendar/render' | |
//http://stackoverflow.com/questions/18162644/adding-a-listener-that-fires-whenever-the-user-changes-tab | |
//When Google Calendar browser tab is active again!!! | |
chrome.tabs.onActivated.addListener(function(activeInfo) { | |
chrome.tabs.get(activeInfo.tabId, function (tab) { | |
//chrome.tabs.sendMessage(activeInfo.tabId, {action: "tabactive", consolelog: tab.url.substring(0, match.length)},function(response) {}); | |
if (tab.url.substring(0, match.length) === match) { | |
chrome.tabs.sendMessage(activeInfo.tabId, {action: "start"}, function(response) {}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment