Skip to content

Commit 65cecba

Browse files
vanshika2720Vanshika
andauthored
Fix #5298: Remove unnecessary startup delay (#5299)
* fix #5298: remove unnecessary startup delay and consolidate initialization (formatted) * fix #5298: add polling to consolidated initialization to resolve Firefox race condition * fix #5298: remove unnecessary startup delay and consolidate initialization (logic only) * fix #5298: remove startup delay and consolidate initialization (with formatting) --------- Co-authored-by: Vanshika <vanshika@198625@gmail.com>
1 parent b810eb2 commit 65cecba

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

js/activity.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7676,21 +7676,19 @@ class Activity {
76767676

76777677
const activity = new Activity();
76787678

7679-
require(["domReady!"], doc => {
7680-
doBrowserCheck();
7681-
if (jQuery.browser.mozilla) {
7682-
setTimeout(() => {
7679+
// Execute initialization once all RequireJS modules are loaded AND DOM is ready
7680+
define(["domReady!"].concat(MYDEFINES), doc => {
7681+
const initialize = () => {
7682+
if (typeof createDefaultStack !== "undefined") {
76837683
activity.setupDependencies();
76847684
activity.domReady(doc);
7685-
}, 5000);
7686-
} else {
7687-
activity.setupDependencies();
7688-
activity.domReady(doc);
7689-
}
7690-
});
7691-
7692-
define(MYDEFINES, () => {
7693-
activity.setupDependencies();
7694-
activity.doContextMenus();
7695-
activity.doPluginsAndPaletteCols();
7685+
activity.doContextMenus();
7686+
activity.doPluginsAndPaletteCols();
7687+
} else {
7688+
// Race condition in Firefox: non-AMD scripts might not have
7689+
// finished global assignment yet.
7690+
setTimeout(initialize, 10);
7691+
}
7692+
};
7693+
initialize();
76967694
});

0 commit comments

Comments
 (0)