Atlas - pre.js
Home / ext / SDL / test / emscripten Lines: 1 | Size: 1211 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1const searchParams = new URLSearchParams(window.location.search); 2 3Module.preRun = () => { 4}; 5 6const arguments = []; 7for (let i = 1; true; i++) { 8 const arg_i = searchParams.get(`arg_${i}`); 9 if (arg_i == null) { 10 break; 11 } 12 arguments.push(arg_i); 13} 14 15Module.arguments = arguments; 16 17if (searchParams.get("loghtml") === "1") { 18 const divTerm = document.createElement("div"); 19 divTerm.id = "terminal"; 20 document.body.append(divTerm); 21 22 function printToStdOut(msg, id) { 23 const divMsg = document.createElement("div", {class: "stdout"}); 24 divMsg.id = id; 25 divMsg.append(document.createTextNode(msg)); 26 divTerm.append(divMsg); 27 return divMsg; 28 } 29 30 Module.print = (msg) => { 31 console.log(msg); 32 printToStdOut(msg, "stdout"); 33 } 34 35 Module.printErr = (msg) => { 36 console.error(msg); 37 const e = printToStdOut(msg, "stderr"); 38 e.style = "color:red"; 39 } 40 41 const divQuit = document.createElement("div"); 42 divQuit.id = "process-quit"; 43 document.body.append(divQuit); 44 45 Module.quit = (msg) => { 46 divQuit.innerText = msg; 47 console.log(`QUIT: ${msg}`) 48 } 49 50 Module.onabort = (msg) => { 51 printToStdOut(`ABORT: ${msg}`, "stderr"); 52 console.log(`ABORT: ${msg}`); 53 } 54} 55[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.