|
28 | 28 | } |
29 | 29 | })(); |
30 | 30 | </script> |
| 31 | + <script> |
| 32 | + // Boot-failure reporter. If the app never mounts (in-app browsers are |
| 33 | + // the usual culprits — see the Telegram blank-page report), show what |
| 34 | + // went wrong instead of a silent dark page. ES5 on purpose: this must |
| 35 | + // run on engines too old for the main bundle, which is exactly when a |
| 36 | + // syntax-level failure would otherwise be invisible. |
| 37 | + (function () { |
| 38 | + var firstError = null; |
| 39 | + function remember(message) { |
| 40 | + if (!firstError && message) firstError = String(message).slice(0, 300); |
| 41 | + } |
| 42 | + window.addEventListener('error', function (e) { |
| 43 | + remember(e.message || (e.target && e.target.src && 'failed to load ' + e.target.src)); |
| 44 | + }, true); |
| 45 | + window.addEventListener('unhandledrejection', function (e) { |
| 46 | + remember(e.reason && (e.reason.message || e.reason)); |
| 47 | + }); |
| 48 | + function check(finalTry) { |
| 49 | + var root = document.getElementById('root'); |
| 50 | + if (!root || root.childNodes.length > 0) return; // mounted — all good |
| 51 | + if (!firstError && !finalTry) { setTimeout(function () { check(true); }, 8000); return; } |
| 52 | + var panel = document.createElement('div'); |
| 53 | + panel.setAttribute('style', |
| 54 | + 'position:fixed;left:12px;right:12px;bottom:12px;z-index:99999;' + |
| 55 | + 'background:#171040;color:#f6f7f8;border:1px solid #ff79c6;border-radius:10px;' + |
| 56 | + 'padding:14px 16px;font:14px/1.5 -apple-system,system-ui,sans-serif;'); |
| 57 | + panel.innerHTML = |
| 58 | + '<b>This page failed to start.</b><br>' + |
| 59 | + (firstError |
| 60 | + ? '<code style="font-size:12px;word-break:break-all;color:#ff79c6;">' + |
| 61 | + firstError.replace(/&/g, '&').replace(/</g, '<') + '</code><br>' |
| 62 | + : '') + |
| 63 | + 'If you are in an in-app browser (Telegram, Instagram…), try ' + |
| 64 | + '“Open in Browser” from its menu. ' + |
| 65 | + '<a href="https://github.com/gpujs/gpu.rocks/issues/31" style="color:#20a4f3;">Report this</a>'; |
| 66 | + document.body.appendChild(panel); |
| 67 | + } |
| 68 | + setTimeout(function () { check(false); }, 7000); |
| 69 | + })(); |
| 70 | + </script> |
31 | 71 | <!-- Dev-server defaults only: scripts/prerender.mjs strips these from the |
32 | 72 | built shell and injects the full per-route set (routeMeta.js values). --> |
33 | 73 | <meta property="og:title" content="GPU.js — GPU accelerated JavaScript"> |
|
0 commit comments