add new maps, persistent storage, music toggle button
This commit is contained in:
28
shell.html
28
shell.html
@@ -62,6 +62,34 @@
|
||||
canvas: document.getElementById('canvas'),
|
||||
print: console.log.bind(console),
|
||||
printErr: console.error.bind(console),
|
||||
|
||||
// Delay main() until IndexedDB-backed storage has been restored.
|
||||
noInitialRun: true,
|
||||
preRun: [function () {
|
||||
try {
|
||||
Module.FS.mkdirTree('/persist');
|
||||
Module.FS.mount(Module.IDBFS, {}, '/persist');
|
||||
Module.__cpStorageMounted = true;
|
||||
} catch (e) {
|
||||
console.error('Catch-Phase: persistent storage unavailable', e);
|
||||
}
|
||||
}],
|
||||
onRuntimeInitialized: function () {
|
||||
const start = () => Module.callMain();
|
||||
if (!Module.__cpStorageMounted) {
|
||||
start();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Module.FS.syncfs(true, function (err) {
|
||||
if (err) console.error('Catch-Phase: failed to load persistent storage', err);
|
||||
start();
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('Catch-Phase: failed to sync persistent storage', e);
|
||||
start();
|
||||
}
|
||||
},
|
||||
};
|
||||
addEventListener('load', () => Module.canvas.focus());
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user