1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Added support for tiddlers preloaded through JavaScript

This commit is contained in:
Jeremy Ruston 2012-10-12 19:01:03 +01:00
parent aba6fb5ffd
commit 36e8040773
2 changed files with 14 additions and 0 deletions

View File

@ -709,6 +709,10 @@ $tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementByI
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("storeArea"))); $tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("storeArea")));
// Load the shadow tiddlers from the DOM // Load the shadow tiddlers from the DOM
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("shadowArea")),true); $tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("shadowArea")),true);
// Load any preloaded tiddlers
if($tw.preloadTiddlers) {
$tw.wiki.addTiddlers($tw.preloadTiddlers,true);
}
// End of if($tw.browser) // End of if($tw.browser)
} }

View File

@ -31,3 +31,13 @@ $tw.modules.define = function(moduleName,moduleType,fn) {
fn: fn fn: fn
}; };
}; };
/*
Define a tiddler
*/
$tw.preloadTiddlers = $tw.preloadTiddlers || [];
$tw.preloadTiddler = function(fields) {
$tw.preloadTiddlers.push(fields);
};