1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Further rearrangements of boot.js

Getting better..
This commit is contained in:
Jeremy Ruston 2013-03-22 19:44:12 +00:00
parent 2c5f2bb67a
commit e336e0661c

View File

@ -359,7 +359,9 @@ $tw.utils.Crypto = function() {
this.updateCryptoStateTiddler(); this.updateCryptoStateTiddler();
}; };
this.updateCryptoStateTiddler = function() { 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() { this.hasPassword = function() {
return !!password; return !!password;
@ -1019,35 +1021,6 @@ $tw.loadTiddlers = function() {
Main startup function that is called once tiddlers have been decrypted Main startup function that is called once tiddlers have been decrypted
*/ */
$tw.boot.startup = function() { $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 // Modules store registers all the modules the system has seen
$tw.modules = $tw.modules || {}; $tw.modules = $tw.modules || {};
@ -1102,6 +1075,37 @@ $tw.config.contentTypeInfo = {
"image/svg+xml": {encoding: "utf8", extension: ".svg"} "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 /////////////////////////// Server initialisation
var fs, path, vm; 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 // Initialise crypto object
$tw.crypto = new $tw.utils.Crypto(); $tw.crypto = new $tw.utils.Crypto();
// Initialise password prompter // Initialise password prompter