From 56eb3dc1dc2dd3aee3493f4baffcddd1df225f2c Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 17 Feb 2012 12:34:28 +0000 Subject: [PATCH] Added support for rendering and refreshing the window title --- js/App.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/js/App.js b/js/App.js index 2e8658bab..d2bc1918d 100644 --- a/js/App.js +++ b/js/App.js @@ -102,6 +102,17 @@ var App = function() { // Open the PageTemplate var renderer = new Renderer("PageTemplate",null,this.store); renderer.renderInDom(document.body); + // Register an event handler to handle refreshing the DOM + this.store.addEventListener("",function(changes) { + renderer.refreshInDom(changes); + }); + // Set the page title and refresh it when needed + var titleRenderer = new Renderer("WindowTitle",null,this.store); + document.title = titleRenderer.render("text/plain"); + this.store.addEventListener("",function(changes) { + titleRenderer.refresh(changes); + document.title = titleRenderer.render("text/plain"); + }); // Set up a timer to change the value of a tiddler var me = this; window.setInterval(function() { @@ -110,10 +121,6 @@ var App = function() { text: "The time was recently " + (new Date()).toString() })); },3000); - // Register an event handler to handle refreshing the DOM - this.store.addEventListener("",function(changes) { - renderer.refreshInDom(changes); - }); } };