Created
October 25, 2012 05:21
-
-
Save nelix/3950529 to your computer and use it in GitHub Desktop.
Chrome extension which reloads all unpacked extensions on opening of a url, for use with gruntjs's watch task.
This file contains hidden or 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
/* | |
* Use with grunt-exec command: 'open -a "/Applications/Google Chrome.app" file://localhost/reload' | |
*/ | |
chrome.webRequest.onBeforeRequest.addListener(hook, {urls: ['file://localhost/reload*']}); | |
function hook(details) { | |
console.log('reloading all dev extensions'); | |
chrome.management.getAll(function(extensions){ | |
for(var i in extensions){ | |
extension = extensions[i]; | |
if (extension.installType == "development" && extension.enabled && extension.name != "Reload Extension") { | |
chrome.management.setEnabled(extension.id, false, function(){ | |
chrome.management.setEnabled(extension.id, true); | |
}); | |
} | |
} | |
}); | |
chrome.tabs.remove(details.tabId); | |
} |
This file contains hidden or 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
{ | |
"name": "Reload Extension", | |
"version": "1", | |
"description": "Reload chrome extension", | |
"permissions": ["management", "tabs", "webRequest", "file://localhost/reload*"], | |
"background": {"scripts":["background.js"]}, | |
"manifest_version": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed missing .id for reenabling the extension.