kopia lustrzana https://github.com/miklobit/TiddlyWiki5
More refactoring of startup.js
rodzic
2a50277219
commit
9965c64b6f
|
@ -1,5 +1,5 @@
|
||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/startup/process-commands.js
|
title: $:/core/modules/startup/commands.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: startup
|
module-type: startup
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@ Command processing
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Export name and synchronous status
|
// Export name and synchronous status
|
||||||
exports.name = "process-commands";
|
exports.name = "commands";
|
||||||
exports.platforms = ["node"];
|
exports.platforms = ["node"];
|
||||||
exports.after = ["setup-story"];
|
exports.after = ["story"];
|
||||||
exports.synchronous = false;
|
exports.synchronous = false;
|
||||||
|
|
||||||
exports.startup = function(callback) {
|
exports.startup = function(callback) {
|
|
@ -1,5 +1,5 @@
|
||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/startup/main-render.js
|
title: $:/core/modules/startup/render.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: startup
|
module-type: startup
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@ Main stylesheet and page rendering
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Export name and synchronous status
|
// Export name and synchronous status
|
||||||
exports.name = "main-render";
|
exports.name = "render";
|
||||||
exports.platforms = ["browser"];
|
exports.platforms = ["browser"];
|
||||||
exports.after = ["rootwidget"];
|
exports.after = ["story"];
|
||||||
exports.synchronous = true;
|
exports.synchronous = true;
|
||||||
|
|
||||||
// Time (in ms) that we defer refreshing changes to draft tiddlers
|
// Time (in ms) that we defer refreshing changes to draft tiddlers
|
|
@ -3,7 +3,7 @@ title: $:/core/modules/startup/rootwidget.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: startup
|
module-type: startup
|
||||||
|
|
||||||
Setup the root widget
|
Setup the root widget and the core root widget handlers
|
||||||
|
|
||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
|
@ -15,7 +15,7 @@ Setup the root widget
|
||||||
// Export name and synchronous status
|
// Export name and synchronous status
|
||||||
exports.name = "rootwidget";
|
exports.name = "rootwidget";
|
||||||
exports.platforms = ["browser"];
|
exports.platforms = ["browser"];
|
||||||
exports.after = ["setup-story"];
|
exports.before = ["story"];
|
||||||
exports.synchronous = true;
|
exports.synchronous = true;
|
||||||
|
|
||||||
var widget = require("$:/core/modules/widgets/widget.js");
|
var widget = require("$:/core/modules/widgets/widget.js");
|
||||||
|
@ -44,10 +44,6 @@ exports.startup = function() {
|
||||||
$tw.rootWidget.addEventListener("tw-scroll",function(event) {
|
$tw.rootWidget.addEventListener("tw-scroll",function(event) {
|
||||||
$tw.pageScroller.handleEvent(event);
|
$tw.pageScroller.handleEvent(event);
|
||||||
});
|
});
|
||||||
// Listen for the tw-home message
|
|
||||||
$tw.rootWidget.addEventListener("tw-home",function(event) {
|
|
||||||
displayDefaultTiddlers();
|
|
||||||
});
|
|
||||||
// Install the save action handlers
|
// Install the save action handlers
|
||||||
$tw.rootWidget.addEventListener("tw-save-wiki",function(event) {
|
$tw.rootWidget.addEventListener("tw-save-wiki",function(event) {
|
||||||
$tw.syncer.saveWiki({
|
$tw.syncer.saveWiki({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/startup/setup-story.js
|
title: $:/core/modules/startup/story.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: startup
|
module-type: startup
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ Load core modules
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Export name and synchronous status
|
// Export name and synchronous status
|
||||||
exports.name = "setup-story";
|
exports.name = "story";
|
||||||
exports.after = ["startup"];
|
exports.after = ["startup"];
|
||||||
exports.synchronous = true;
|
exports.synchronous = true;
|
||||||
|
|
||||||
|
@ -41,6 +41,12 @@ exports.startup = function() {
|
||||||
openStartupTiddlers({defaultToCurrentStory: true});
|
openStartupTiddlers({defaultToCurrentStory: true});
|
||||||
}
|
}
|
||||||
},false)
|
},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);
|
var currStoryList = $tw.wiki.getTiddlerList(DEFAULT_STORY_TITLE);
|
||||||
storyFilter = $tw.utils.stringifyList(currStoryList);
|
storyFilter = $tw.utils.stringifyList(currStoryList);
|
||||||
} else {
|
} else {
|
||||||
storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE);
|
storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var storyList = $tw.wiki.filterTiddlers(storyFilter);
|
var storyList = $tw.wiki.filterTiddlers(storyFilter);
|
Ładowanie…
Reference in New Issue