cakefoot/src/pre_js.js

49 lines
1.3 KiB
JavaScript

/*~~~~.
|\~~~~: [ C A K E F O O T ] presented by dank.game
|\\~~~|
|#\\~~: open source code and license details at https://open.shampoo.ooo/shampoo/cakefoot
\\#\\~|
\\#\\: created using the SPACE🪐BOX engine https://open.shampoo.ooo/shampoo/spacebox
\\#\'
\\#|
```
@file pre_js.js
Customization of Emscripten's Module object and other JavaScript to be included in WASM builds.
*/
function collectData() {}
/* Set Emscripten to use a canvas for display. */
Module.canvas = document.getElementById("canvas");
/* Turn off automatic call to main function */
Module.noInitialRun = true;
/* Mount storage for the save file and run game */
Module.onRuntimeInitialized = function()
{
FS.mkdir("/storage");
FS.mount(IDBFS, {}, "/storage");
FS.syncfs(true, function(error) {
if (error !== null)
{
console.log("Error mounting storage with Filesystem API", error);
}
else
{
if (document.getElementById("loading"))
{
document.getElementById("loading").remove();
}
document.getElementById("canvas").style.display = "block";
_main();
}
});
/* Log the session ID */
console.log("Your session ID is \"" + document.cookie.match(/PHPSESSID=([^;]+)/)[1] + "\" gamer 🪧");
}