Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changing the autoRefresh back. Not refreshing when not focusing was a…

…ctually a little annoying.
  • Loading branch information...
commit 43cb4a09b3d2bfa974b4d6879da67f0b2aa8496b 1 parent 444ee6a
Joel Johnson authored
Showing with 6 additions and 12 deletions.
  1. +6 −12 src/main/webapp/autoRefresh.js
18 src/main/webapp/autoRefresh.js
View
@@ -1,14 +1,6 @@
+var intervalID;
Event.observe(window, 'load', function() {
- window.setInterval(updateView, 10000);
-});
-
-var updateView = (function() {
- if(!window.isFocused) {
- console.log('not auto-updating: window is not focused');
- return;
- }
- console.log('auto-updating: window is focused');
- update();
+ intervalID = window.setInterval(update, 10000);
});
function update() {
@@ -39,10 +31,12 @@ function update() {
}
Event.observe(window, 'focus', function() {
- window.isFocused = true;
+ window.clearInterval(intervalID);
+ intervalID = window.setInterval(update, 10000);
update();
});
Event.observe(window, 'blur', function() {
- window.isFocused = false;
+ window.clearInterval(intervalID);
+ intervalID = window.setInterval(update, 20000);
});
Please sign in to comment.
Something went wrong with that request. Please try again.