1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-26 07:13:15 +00:00

More refactoring of startup.js

This commit is contained in:
Jermolene 2014-05-05 15:25:51 +01:00
parent 2a50277219
commit 9965c64b6f
4 changed files with 17 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/*\
title: $:/core/modules/startup/process-commands.js
title: $:/core/modules/startup/commands.js
type: application/javascript
module-type: startup
@ -13,9 +13,9 @@ Command processing
"use strict";
// Export name and synchronous status
exports.name = "process-commands";
exports.name = "commands";
exports.platforms = ["node"];
exports.after = ["setup-story"];
exports.after = ["story"];
exports.synchronous = false;
exports.startup = function(callback) {

View File

@ -1,5 +1,5 @@
/*\
title: $:/core/modules/startup/main-render.js
title: $:/core/modules/startup/render.js
type: application/javascript
module-type: startup
@ -13,9 +13,9 @@ Main stylesheet and page rendering
"use strict";
// Export name and synchronous status
exports.name = "main-render";
exports.name = "render";
exports.platforms = ["browser"];
exports.after = ["rootwidget"];
exports.after = ["story"];
exports.synchronous = true;
// Time (in ms) that we defer refreshing changes to draft tiddlers

View File

@ -3,7 +3,7 @@ title: $:/core/modules/startup/rootwidget.js
type: application/javascript
module-type: startup
Setup the root widget
Setup the root widget and the core root widget handlers
\*/
(function(){
@ -15,7 +15,7 @@ Setup the root widget
// Export name and synchronous status
exports.name = "rootwidget";
exports.platforms = ["browser"];
exports.after = ["setup-story"];
exports.before = ["story"];
exports.synchronous = true;
var widget = require("$:/core/modules/widgets/widget.js");
@ -44,10 +44,6 @@ exports.startup = function() {
$tw.rootWidget.addEventListener("tw-scroll",function(event) {
$tw.pageScroller.handleEvent(event);
});
// Listen for the tw-home message
$tw.rootWidget.addEventListener("tw-home",function(event) {
displayDefaultTiddlers();
});
// Install the save action handlers
$tw.rootWidget.addEventListener("tw-save-wiki",function(event) {
$tw.syncer.saveWiki({

View File

@ -1,5 +1,5 @@
/*\
title: $:/core/modules/startup/setup-story.js
title: $:/core/modules/startup/story.js
type: application/javascript
module-type: startup
@ -13,7 +13,7 @@ Load core modules
"use strict";
// Export name and synchronous status
exports.name = "setup-story";
exports.name = "story";
exports.after = ["startup"];
exports.synchronous = true;
@ -41,6 +41,12 @@ exports.startup = function() {
openStartupTiddlers({defaultToCurrentStory: true});
}
},false)
// Listen for the tw-home message
$tw.rootWidget.addEventListener("tw-home",function(event) {
var storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE),
storyList = $tw.wiki.filterTiddlers(storyFilter);
$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields());
});
}
};
@ -77,7 +83,7 @@ function openStartupTiddlers(options) {
var currStoryList = $tw.wiki.getTiddlerList(DEFAULT_STORY_TITLE);
storyFilter = $tw.utils.stringifyList(currStoryList);
} else {
storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE);
storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE);
}
}
var storyList = $tw.wiki.filterTiddlers(storyFilter);