Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chromeDevenvPoller__.js.tmpl

Issue 9051052: Changes to Chrome build process (Closed)
Patch Set: Moved JSHydra dependency to build tools and added automatic devenv reloading Created Dec. 29, 2012, 8:14 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build.py ('k') | manifest.json.tmpl » ('j') | packagerChrome.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeDevenvPoller__.js.tmpl
===================================================================
new file mode 100644
--- /dev/null
+++ b/chromeDevenvPoller__.js.tmpl
@@ -0,0 +1,27 @@
+(function()
+{
+ var basename = {{metadata.get("general", "basename")|json}};
+
+ function doPoll()
+ {
+ var request = new XMLHttpRequest();
+ request.open("GET", "http://localhost:43816/");
+ request.addEventListener("load", function()
+ {
+ if (request.responseText != basename)
+ return;
+
+ var views = chrome.extension.getViews();
+ for (var i = 0; i < views.length; i++)
+ if (views[i] != window)
+ views[i].close();
+ window.location.reload();
+ }, false);
+ request.send(null);
+
+ window.setTimeout(doPoll, 5000);
+ }
+
+ // Delay first poll to prevent reloading again immediately after a reload
+ window.setTimeout(doPoll, 10000);
+})();
« no previous file with comments | « build.py ('k') | manifest.json.tmpl » ('j') | packagerChrome.py » ('J')

Powered by Google App Engine
This is Rietveld