Use onstorage event - don't poll. Increase screenshot frequency to one second.

This commit is contained in:
Michael Jumper
2012-11-07 10:15:01 -08:00
parent 3b3f213c6d
commit d1aeb5e347
4 changed files with 7 additions and 14 deletions

View File

@@ -132,6 +132,9 @@ GuacamoleHistory = new (function() {
*/
this.onchange = null;
// Reload when modified
window.addEventListener("storage", guac_history.reload);
// Initial load
guac_history.reload();

View File

@@ -418,9 +418,8 @@ GuacamoleUI.attach = function(guac) {
if (GuacamoleUI.sessionState.getProperty("clipboard"))
guac.setClipboard(GuacamoleUI.sessionState.getProperty("clipboard"));
// Regularly update screenshot if storage available
if (localStorage)
window.setInterval(updateThumbnail, 5000);
// Regularly update screenshot
window.setInterval(updateThumbnail, 1000);
break;

View File

@@ -323,12 +323,6 @@ GuacamoleRootUI.reset = function() {
GuacamoleRootUI.views.login.style.display = "none";
GuacamoleRootUI.views.connections.style.display = "";
// Reload history every 5 seconds
window.setInterval(GuacamoleHistory.reload, 5000);
// Reload history when focus gained
window.onfocus = GuacamoleHistory.reload;
};
GuacamoleHistory.onchange = function(id, old_entry, new_entry) {

View File

@@ -98,12 +98,9 @@ function GuacamoleSessionState() {
*/
this.onchange = null;
// Reload properties every second
window.setInterval(guac_state.reload, 1000);
// Reload when modified
window.addEventListener("storage", guac_state.reload);
// Reload properties when focus is gained
window.addEventListener("focus", guac_state.reload);
// Initial load
guac_state.reload();