Commit the pending application, help and browser regression work. Pin the patched PKCS dependency for the production release.
25 lines
1.3 KiB
JavaScript
25 lines
1.3 KiB
JavaScript
/* Parser-blocking shell bootstrap: no DOM/body, layout, or network dependencies. */
|
|
(() => {
|
|
const root = document.documentElement;
|
|
const key = 'plotdirector.displayMode';
|
|
const media = window.matchMedia('(display-mode: standalone)');
|
|
let established = false;
|
|
try { established = sessionStorage.getItem(key) === 'standalone'; } catch { }
|
|
root.dataset.standalone = String(established);
|
|
let verified = false;
|
|
const verify = () => {
|
|
const current = media.matches || navigator.standalone === true;
|
|
const changed = !verified || current !== established;
|
|
established = current; verified = true;
|
|
root.dataset.standalone = String(established);
|
|
try { sessionStorage.setItem(key, established ? 'standalone' : 'browser'); } catch { }
|
|
if (changed) window.dispatchEvent(new CustomEvent('plotdirector:pwa-mode-changed', { detail: { standalone: established } }));
|
|
};
|
|
window.PlotDirectorPwa = Object.freeze({ get standalone() { return established; } });
|
|
// Verify synchronously before the body can paint, including first-ever launch.
|
|
// Session storage is window scoped: an installed window cannot poison a browser tab.
|
|
verify();
|
|
media.addEventListener('change', verify);
|
|
window.addEventListener('pageshow', verify);
|
|
})();
|