From 0d45d76af68751787e22833ec9cd846b7343def6 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 25 Jan 2012 12:05:18 +0000 Subject: [PATCH] Finally, selective refreshing now works Although it's a bit hard to see which DOM nodes have been refreshed. --- js/App.js | 4 ++-- js/WikiStore.js | 35 ++++++++++++++++++++++++++++------- js/WikiTextRenderer.js | 4 ---- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/js/App.js b/js/App.js index 0fa63c64d..a39193f85 100644 --- a/js/App.js +++ b/js/App.js @@ -115,8 +115,8 @@ var App = function() { var me = this; window.setInterval(function() { me.store.addTiddler(new Tiddler({ - title: "HelloThere", - text: "This tiddler is growing\n" + me.store.getTiddlerText("HelloThere") + title: "TiddlyWiki5", + text: "This tiddler is new" })); },3000); // Register an event handler to handle refreshing the DOM diff --git a/js/WikiStore.js b/js/WikiStore.js index 2dc18b969..ed47964cc 100755 --- a/js/WikiStore.js +++ b/js/WikiStore.js @@ -386,14 +386,16 @@ WikiStore.prototype.renderMacro = function(macroName,targetType,tiddler,params,c /* Refresh a DOM node and it's children so that it reflects the current state of the store node: reference to the DOM node to be refreshed - changes: hashmap of {title: "created|modified|deleted"} + changes: hashmap of {title: "created|modified|deleted"} + renderer: the renderer to use to refresh the node (usually pass null) + tiddler: the tiddler to use as the context for executing the renderer */ -WikiStore.prototype.refreshDomNode = function(node,changes) { +WikiStore.prototype.refreshDomNode = function(node,changes,renderer,tiddler) { var me = this, - refreshChildNodes = function(node) { + refreshChildNodes = function(node,renderer,tidder) { if(node.hasChildNodes()) { for(var c=0; c