Created
August 30, 2017 21:11
-
-
Save timdorr/884f42608f36a61d66af74b6bb3d2285 to your computer and use it in GitHub Desktop.
Webpack Chrome Extension Page Reloader Plugin
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
tell application "Google Chrome" | |
set extensionURL to "chrome://extensions/" | |
set found to false | |
set theTabIndex to -1 | |
repeat with theWindow in every window | |
set theTabIndex to 0 | |
repeat with theTab in every tab of theWindow | |
set theTabIndex to theTabIndex + 1 | |
if theTab's URL starts with extensionURL then | |
set found to true | |
exit repeat | |
end if | |
end repeat | |
if found then | |
exit repeat | |
end if | |
end repeat | |
if found then | |
tell theTab to reload | |
else | |
tell window 1 to make new tab with properties {URL:extensionURL} | |
end if | |
end tell |
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
function ReloadPlugin() {} | |
ReloadPlugin.prototype.apply = compiler => { | |
ReloadPlugin.watching = false | |
compiler.plugin('watch-run', (p, cb) => { | |
ReloadPlugin.watching = true | |
cb() | |
}) | |
compiler.plugin('done', () => { | |
if (ReloadPlugin.watching) { | |
child.exec('osascript reload_extensions.scpt') | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment