1/** 2 * PWA Install Prompt Early Capture 3 * 4 * This script captures the beforeinstallprompt event BEFORE React hydration. 5 * It must be loaded synchronously (no async/defer) in the <head> to catch 6 * the event on mobile browsers where it fires early. 7 * 8 * The captured event is stored on window.__pwaInstallPromptEvent for the 9 * usePwaInstall React hook to consume. 10 */ 11(function () { 12 window.addEventListener("beforeinstallprompt", function (e) { 13 // preventDefault suppresses the browser mini-infobar so the app can drive 14 // install UX on its own terms; the stashed event is the only handle to the 15 // deferred prompt (window.__pwaInstallPromptEvent -> usePwaInstall hook). 16 e.preventDefault(); 17 window.__pwaInstallPromptEvent = e; 18 if (typeof console !== "undefined") { 19 // eslint-disable-next-line no-console 20 console.log("[PWA] beforeinstallprompt captured (early)"); 21 } 22 }); 23})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.