mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 11:16:42 +01:00
fix microw8.html no-autoload mode
This commit is contained in:
@@ -15,8 +15,8 @@
|
|||||||
<div id="centered">
|
<div id="centered">
|
||||||
<canvas id="screen" width="320" height="240">
|
<canvas id="screen" width="320" height="240">
|
||||||
</canvas>
|
</canvas>
|
||||||
<div id="timer" hidden="true"></div>
|
<div id="timer" hidden="true"></div>
|
||||||
<div id="message"></div>
|
<div id="message"></div>
|
||||||
<button id="cartButton" style="visibility:hidden">Load cart...</button>
|
<button id="cartButton" style="visibility:hidden">Load cart...</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
|
|||||||
@@ -79,7 +79,9 @@ if(location.hash.length != 0) {
|
|||||||
url += 'cart.uw8';
|
url += 'cart.uw8';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await uw8.runModuleFromURL(url, true);
|
if(!await uw8.runModuleFromURL(url, true)) {
|
||||||
|
setupLoad();
|
||||||
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
setupLoad();
|
setupLoad();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,10 +305,11 @@ export default function MicroW8(screen, config = {}) {
|
|||||||
async function runModuleFromURL(url, keepUrl) {
|
async function runModuleFromURL(url, keepUrl) {
|
||||||
let response = await fetch(url);
|
let response = await fetch(url);
|
||||||
let type = response.headers.get('Content-Type');
|
let type = response.headers.get('Content-Type');
|
||||||
if(type && type.includes('html')) {
|
if((type && type.includes('html')) || response.status != 200) {
|
||||||
throw false;
|
return false;
|
||||||
}
|
}
|
||||||
runModule(await response.arrayBuffer(), keepUrl || devkitMode);
|
runModule(await response.arrayBuffer(), keepUrl || devkitMode);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user