mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-25 06:43:15 +00:00
Refactor startup action execution so that they can switch language/theme
This commit is contained in:
parent
c036c22826
commit
2c2d03f7a7
|
@ -55,6 +55,27 @@ exports.startup = function() {
|
||||||
$tw.version = $tw.utils.extractVersionInfo();
|
$tw.version = $tw.utils.extractVersionInfo();
|
||||||
// Set up the performance framework
|
// Set up the performance framework
|
||||||
$tw.perf = new $tw.Performance($tw.wiki.getTiddlerText(PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE,"no") === "yes");
|
$tw.perf = new $tw.Performance($tw.wiki.getTiddlerText(PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE,"no") === "yes");
|
||||||
|
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
|
||||||
|
$tw.rootWidget = new widget.widget({
|
||||||
|
type: "widget",
|
||||||
|
children: []
|
||||||
|
},{
|
||||||
|
wiki: $tw.wiki,
|
||||||
|
document: $tw.browser ? document : $tw.fakeDocument
|
||||||
|
});
|
||||||
|
// Execute any startup actions
|
||||||
|
var executeStartupTiddlers = function(tag) {
|
||||||
|
$tw.utils.each($tw.wiki.filterTiddlers("[all[shadows+tiddlers]tag[" + tag + "]!has[draft.of]]"),function(title) {
|
||||||
|
$tw.rootWidget.invokeActionString($tw.wiki.getTiddlerText(title),$tw.rootWidget);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
executeStartupTiddlers("$:/tags/StartupAction");
|
||||||
|
if($tw.browser) {
|
||||||
|
executeStartupTiddlers("$:/tags/StartupAction/Browser");
|
||||||
|
}
|
||||||
|
if($tw.node) {
|
||||||
|
executeStartupTiddlers("$:/tags/StartupAction/Node");
|
||||||
|
}
|
||||||
// Kick off the language manager and switcher
|
// Kick off the language manager and switcher
|
||||||
$tw.language = new $tw.Language();
|
$tw.language = new $tw.Language();
|
||||||
$tw.languageSwitcher = new $tw.PluginSwitcher({
|
$tw.languageSwitcher = new $tw.PluginSwitcher({
|
||||||
|
@ -95,27 +116,6 @@ exports.startup = function() {
|
||||||
handlerMethod: "handleKeydownEvent"
|
handlerMethod: "handleKeydownEvent"
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
|
|
||||||
$tw.rootWidget = new widget.widget({
|
|
||||||
type: "widget",
|
|
||||||
children: []
|
|
||||||
},{
|
|
||||||
wiki: $tw.wiki,
|
|
||||||
document: $tw.browser ? document : $tw.fakeDocument
|
|
||||||
});
|
|
||||||
// Execute any startup actions
|
|
||||||
var executeStartupTiddlers = function(tag) {
|
|
||||||
$tw.utils.each($tw.wiki.filterTiddlers("[all[shadows+tiddlers]tag[" + tag + "]!has[draft.of]]"),function(title) {
|
|
||||||
$tw.rootWidget.invokeActionString($tw.wiki.getTiddlerText(title),$tw.rootWidget);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
executeStartupTiddlers("$:/tags/StartupAction");
|
|
||||||
if($tw.browser) {
|
|
||||||
executeStartupTiddlers("$:/tags/StartupAction/Browser");
|
|
||||||
}
|
|
||||||
if($tw.node) {
|
|
||||||
executeStartupTiddlers("$:/tags/StartupAction/Node");
|
|
||||||
}
|
|
||||||
// Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup
|
// Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup
|
||||||
$tw.wiki.clearTiddlerEventQueue();
|
$tw.wiki.clearTiddlerEventQueue();
|
||||||
// Find a working syncadaptor
|
// Find a working syncadaptor
|
||||||
|
|
Loading…
Reference in New Issue
Block a user