| <!DOCTYPE html> |
| <html> |
| |
| <head> |
| <meta charset="utf-8"> |
| <meta content="IE=edge" http-equiv="X-UA-Compatible"> |
| <meta content="width=device-width, initial-scale=1.0" name="viewport"> |
| <title>VibePad | Shared App</title> |
| <style> |
| html, |
| body { |
| margin: 0; |
| padding: 0; |
| width: 100%; |
| height: 100%; |
| background-color: #121212; |
| color: #e0e0e0; |
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; |
| overflow: hidden; |
| } |
| |
| #status { |
| position: absolute; |
| top: 50%; |
| left: 50%; |
| transform: translate(-50%, -50%); |
| font-size: 18px; |
| color: #aaa; |
| } |
| </style> |
| <script src="flutter.js"></script> |
| </head> |
| |
| <body> |
| <div id="status">Loading app...</div> |
| <script type="module"> |
| // Configure standard builds list for the flutter.js loader |
| window._flutter.buildConfig = { |
| engineRevision: "3.22.0", |
| builds: [ |
| { |
| compileTarget: "dart2wasm", |
| renderer: "skwasm", |
| mainWasmPath: "main.wasm", |
| jsSupportRuntimePath: "main.js" |
| }, |
| { |
| compileTarget: "dart2wasm", |
| renderer: "canvaskit", |
| mainWasmPath: "main.wasm", |
| jsSupportRuntimePath: "main.js" |
| } |
| ] |
| }; |
| |
| const loadWasmApp = async () => { |
| try { |
| const loader = window._flutter.loader; |
| await loader.load({ |
| config: { |
| canvasKitBaseUrl: 'canvaskit/', |
| 'wasmAllowList': { |
| 'gecko': true, |
| 'webkit': true |
| } |
| }, |
| onEntrypointLoaded: async function (engineInitializer) { |
| const statusDiv = document.getElementById('status'); |
| statusDiv.innerText = 'Initializing app...'; |
| try { |
| const appRunner = await engineInitializer.initializeEngine({ |
| canvasKitBaseUrl: 'canvaskit/', |
| }); |
| statusDiv.remove(); |
| await appRunner.runApp(); |
| } catch (e) { |
| statusDiv.innerText = 'Error initializing Flutter engine:\n' + e.stack; |
| console.error(e); |
| } |
| } |
| }); |
| } catch (e) { |
| const statusDiv = document.getElementById('status'); |
| statusDiv.innerText = 'Error running WASM app:\n' + e.stack; |
| console.error(e); |
| } |
| }; |
| window.addEventListener('load', loadWasmApp); |
| </script> |
| </body> |
| |
| </html> |