Introduce post-render startup actions

This commit is contained in:
jeremy@jermolene.com
2020-10-25 16:22:21 +00:00
parent 1a91f81976
commit 5cc1600072
4 changed files with 30 additions and 14 deletions
+2
View File
@@ -106,6 +106,8 @@ exports.startup = function() {
// Fix up the link between the root widget and the page container
$tw.rootWidget.domNodes = [$tw.pageContainer];
$tw.rootWidget.children = [$tw.pageWidgetNode];
// Run any post-render startup actions
$tw.rootWidget.executeStartupTiddlers("$:/tags/StartupAction/PostRender");
};
})();
+3 -8
View File
@@ -64,17 +64,12 @@ exports.startup = function() {
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");
$tw.rootWidget.executeStartupTiddlers("$:/tags/StartupAction");
if($tw.browser) {
executeStartupTiddlers("$:/tags/StartupAction/Browser");
$tw.rootWidget.executeStartupTiddlers("$:/tags/StartupAction/Browser");
}
if($tw.node) {
executeStartupTiddlers("$:/tags/StartupAction/Node");
$tw.rootWidget.executeStartupTiddlers("$:/tags/StartupAction/Node");
}
// Kick off the language manager and switcher
$tw.language = new $tw.Language();