Further rearrangements of boot.js

Getting better..
print-window-tiddler
Jeremy Ruston 2013-03-22 19:44:12 +00:00
rodzic 2c5f2bb67a
commit e336e0661c
1 zmienionych plików z 34 dodań i 35 usunięć

Wyświetl plik

@ -359,7 +359,9 @@ $tw.utils.Crypto = function() {
this.updateCryptoStateTiddler();
};
this.updateCryptoStateTiddler = function() {
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: password ? "yes" : "no"}));
if($tw.wiki && $tw.wiki.addTiddler) {
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: password ? "yes" : "no"}));
}
};
this.hasPassword = function() {
return !!password;
@ -1019,35 +1021,6 @@ $tw.loadTiddlers = function() {
Main startup function that is called once tiddlers have been decrypted
*/
$tw.boot.startup = function() {
// Install built in tiddler fields modules
$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield");
// Install the tiddler deserializer modules
$tw.Wiki.tiddlerDeserializerModules = {};
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules);
// Load tiddlers
$tw.loadTiddlers();
// Unpack bundle tiddlers
$tw.wiki.unpackBundleTiddlers();
// Register typed modules from the tiddlers we've just loaded
$tw.wiki.defineTiddlerModules();
// And any modules within bundles
$tw.wiki.defineBundledModules();
// Make sure the crypto state tiddler is up to date
$tw.crypto.updateCryptoStateTiddler();
// Run any startup modules
$tw.modules.forEachModuleOfType("startup",function(title,module) {
if(module.startup) {
module.startup();
}
});
};
/*
Initialise crypto and then startup
*/
// Plugin state
$tw.plugins = {};
// Modules store registers all the modules the system has seen
$tw.modules = $tw.modules || {};
@ -1102,6 +1075,37 @@ $tw.config.contentTypeInfo = {
"image/svg+xml": {encoding: "utf8", extension: ".svg"}
};
/*
Create the wiki store for the app
*/
$tw.wiki = new $tw.Wiki();
// Install built in tiddler fields modules
$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield");
// Install the tiddler deserializer modules
$tw.Wiki.tiddlerDeserializerModules = {};
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules);
// Load tiddlers
$tw.loadTiddlers();
// Unpack bundle tiddlers
$tw.wiki.unpackBundleTiddlers();
// Register typed modules from the tiddlers we've just loaded
$tw.wiki.defineTiddlerModules();
// And any modules within bundles
$tw.wiki.defineBundledModules();
// Make sure the crypto state tiddler is up to date
$tw.crypto.updateCryptoStateTiddler();
// Run any startup modules
$tw.modules.forEachModuleOfType("startup",function(title,module) {
if(module.startup) {
module.startup();
}
});
};
/*
Initialise crypto and then startup
*/
/////////////////////////// Server initialisation
var fs, path, vm;
@ -1131,11 +1135,6 @@ if(!$tw.browser) {
}
}
/*
Create the wiki store for the app
*/
$tw.wiki = new $tw.Wiki();
// Initialise crypto object
$tw.crypto = new $tw.utils.Crypto();
// Initialise password prompter