mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 14:55:43 +00:00
5167d8f49e
* feat(ui): add themed startup splash with deferred window show Show a theme-aware loading splash before the Vite bundle mounts, hide the native window until it paints, and use per-theme logo gradient colors. * docs: note startup splash in CHANGELOG and credits for PR #1030 * docs: attribute PR #1030 startup splash to cucadmuh
29 lines
775 B
JavaScript
29 lines
775 B
JavaScript
/**
|
|
* Show the native window after the inline startup splash has painted.
|
|
* __TAURI_INTERNALS__ may not exist yet when this script first runs.
|
|
*/
|
|
(function startupSplashReveal() {
|
|
var MAX_ATTEMPTS = 60;
|
|
|
|
function tryShowMainWindow() {
|
|
var internals = window.__TAURI_INTERNALS__;
|
|
if (!internals || typeof internals.invoke !== 'function') return false;
|
|
internals.invoke('plugin:window|show', { label: 'main' }).catch(function () {});
|
|
return true;
|
|
}
|
|
|
|
function reveal(attempt) {
|
|
if (tryShowMainWindow()) return;
|
|
if (attempt >= MAX_ATTEMPTS) return;
|
|
window.setTimeout(function () {
|
|
reveal(attempt + 1);
|
|
}, 50);
|
|
}
|
|
|
|
requestAnimationFrame(function () {
|
|
requestAnimationFrame(function () {
|
|
reveal(0);
|
|
});
|
|
});
|
|
})();
|