Skip to content

Commit

Permalink
Tweak startup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
msmithNI committed Oct 26, 2024
1 parent 3c2dbaf commit 599ad47
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ function registerNimbleEvents(Blazor) {
});
}

function handleRuntimeStarted() {
window.requestAnimationFrame(() => {
window.NimbleBlazor.hasRuntimeStarted = true;
});
}

// Blazor Web Apps
export function afterWebStarted(Blazor) {
registerNimbleEvents(Blazor);
Expand All @@ -171,11 +177,11 @@ export function afterWebStarted(Blazor) {
}

export function afterServerStarted(_Blazor) {
window.NimbleBlazor.hasRuntimeStarted = true;
handleRuntimeStarted();
}

export function afterWebAssemblyStarted(_Blazor) {
window.NimbleBlazor.hasRuntimeStarted = true;
handleRuntimeStarted();
}

// Blazor Server/WebAssembly/Hybrid apps
Expand All @@ -186,7 +192,7 @@ export function afterStarted(Blazor) {
registerNimbleEvents(Blazor);
}

window.NimbleBlazor.hasRuntimeStarted = true;
handleRuntimeStarted();
}

if (window.NimbleBlazor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export function registerSprightEvents(Blazor) {
*/
}

function handleRuntimeStarted() {
window.requestAnimationFrame(() => {
window.NimbleBlazor.hasRuntimeStarted = true;
});
}

// Blazor Web Apps
export function afterWebStarted(Blazor) {
registerSprightEvents(Blazor);
Expand All @@ -42,11 +48,11 @@ export function afterWebStarted(Blazor) {
}

export function afterServerStarted(_Blazor) {
window.SprightBlazor.hasRuntimeStarted = true;
handleRuntimeStarted();
}

export function afterWebAssemblyStarted(_Blazor) {
window.SprightBlazor.hasRuntimeStarted = true;
handleRuntimeStarted();
}

// Blazor Server/WebAssembly/Hybrid apps
Expand All @@ -57,7 +63,7 @@ export function afterStarted(Blazor) {
registerSprightEvents(Blazor);
}

window.NimbleBlazor.hasRuntimeStarted = true;
handleRuntimeStarted();
}

if (window.SprightBlazor) {
Expand Down

0 comments on commit 599ad47

Please sign in to comment.