1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-26 19:47:20 +00:00

Refactor boot sequence

This is the start of making it possible to use TiddlyWiki5 as a library
from a node.js application
This commit is contained in:
Jeremy Ruston 2013-08-20 15:17:57 +01:00
parent 1fd59a4bd3
commit 644d9f9405
2 changed files with 21 additions and 11 deletions

View File

@ -1374,19 +1374,26 @@ $tw.boot.startup = function() {
});
};
/////////////////////////// Decrypt tiddlers and then startup
/////////////////////////// Main boot function to decrypt tiddlers and then startup
$tw.boot.boot = function() {
// Initialise crypto object
$tw.crypto = new $tw.utils.Crypto();
// Initialise password prompter
if($tw.browser) {
$tw.passwordPrompt = new $tw.utils.PasswordPrompt();
}
// Preload any encrypted tiddlers
$tw.boot.decryptEncryptedTiddlers(function() {
// Startup
$tw.boot.startup();
});
};
/////////////////////////// Autoboot in the browser
// Initialise crypto object
$tw.crypto = new $tw.utils.Crypto();
// Initialise password prompter
if($tw.browser) {
$tw.passwordPrompt = new $tw.utils.PasswordPrompt();
$tw.boot.boot();
}
// Preload any encrypted tiddlers
$tw.boot.decryptEncryptedTiddlers(function() {
// Startup
$tw.boot.startup();
});
})();

View File

@ -5,3 +5,6 @@ This is invoked as a shell script by NPM when the `tiddlywiki` command is typed
*/
var tiddlywiki = require("./boot/boot.js");
// Boot the TW5 app
$tw.boot.boot();