Skip to content

Commit

Permalink
adds a timeout to wait for tGameMain to exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin committed May 17, 2024
1 parent ae0440b commit 334f882
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions flowerful.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import { RegisterPatch, ApplyAllPatches } from "./flowerful.patches";
declare const nw: any;

/* Set this to true to get ALL the spammy log messages */
const debuglogging = false;
const debuglogging = true;

/**
* This is how long flower waits in ms before setting up at the start
* This will need to be configurable on a per-game basis
*/
const timeout = 75;

//#region flower_ctor

Expand Down Expand Up @@ -163,7 +169,10 @@ function SetupLogger()
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
}, function (win: any)
{
win.once('loaded', function () { onLoggerWindowLoaded(win) });
win.once('loaded', function ()
{
onLoggerWindowLoaded(win);
});
});
}

Expand All @@ -181,5 +190,8 @@ function onLoggerWindowLoaded(win: any)

window.onload = function ()
{
SetupLogger();
window.setTimeout(() =>
{
SetupLogger();
}, timeout);
};

0 comments on commit 334f882

Please sign in to comment.