1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-06 22:04:19 +00:00

Make sure rootwidget is available before background actions start

This commit is contained in:
Jeremy Ruston 2025-01-24 11:15:27 +00:00
parent 0baf395030
commit 28c1e77b60
2 changed files with 10 additions and 10 deletions

View File

@ -19,6 +19,8 @@ exports.synchronous = true;
// Set to `true` to enable performance instrumentation // Set to `true` to enable performance instrumentation
var PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE = "$:/config/Performance/Instrumentation"; var PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE = "$:/config/Performance/Instrumentation";
var widget = require("$:/core/modules/widgets/widget.js");
exports.startup = function() { exports.startup = function() {
// Load modules // Load modules
$tw.modules.applyMethods("utils",$tw.utils); $tw.modules.applyMethods("utils",$tw.utils);
@ -42,6 +44,14 @@ exports.startup = function() {
// The rest of the startup process here is not strictly to do with loading modules, but are needed before other startup // The rest of the startup process here is not strictly to do with loading modules, but are needed before other startup
// modules are executed. It is easier to put them here than to introduce a new startup module // modules are executed. It is easier to put them here than to introduce a new startup module
// -------------------------- // --------------------------
// 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
});
// 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");
// Kick off the filter tracker // Kick off the filter tracker

View File

@ -17,8 +17,6 @@ exports.name = "startup";
exports.after = ["load-modules"]; exports.after = ["load-modules"];
exports.synchronous = true; exports.synchronous = true;
var widget = require("$:/core/modules/widgets/widget.js");
exports.startup = function() { exports.startup = function() {
// Minimal browser detection // Minimal browser detection
if($tw.browser) { if($tw.browser) {
@ -54,14 +52,6 @@ exports.startup = function() {
} }
// Initialise version // Initialise version
$tw.version = $tw.utils.extractVersionInfo(); $tw.version = $tw.utils.extractVersionInfo();
// 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 // Execute any startup actions
$tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction"); $tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction");
if($tw.browser) { if($tw.browser) {