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

Tying up the ability to load javascript modules as tiddlers

This commit is contained in:
Jeremy Ruston 2012-03-01 23:24:25 +00:00
parent 96d8c15f72
commit a274bad1a2

View File

@ -36,6 +36,7 @@ var App = function() {
this.store.registerParser("image/gif",imageParser);
// Set up the JavaScript parser
this.store.jsParser = new JavaScriptParser();
this.store.registerParser("application/javascript",this.store.jsParser);
// Register the standard tiddler serializers and deserializers
tiddlerInput.register(this.store);
tiddlerOutput.register(this.store);
@ -75,7 +76,14 @@ var App = function() {
}
// If in the browser, load the tiddlers built into the TiddlyWiki document
if(this.isBrowser) {
var storeArea = document.getElementById("storeArea"),
// First, the JavaScript system tiddlers
var moduleArea = document.getElementById("jsModules"),
tiddlers = this.store.deserializeTiddlers("(DOM)",moduleArea);
for(t=0; t<tiddlers.length; t++) {
this.store.addTiddler(new Tiddler(tiddlers[t]));
}
// Then, the ordinary tiddlers baked into the storeArea
var storeArea = document.getElementById("storeArea");
tiddlers = this.store.deserializeTiddlers("(DOM)",storeArea);
for(t=0; t<tiddlers.length; t++) {
this.store.addTiddler(new Tiddler(tiddlers[t]));