fix: correctly detect failed iframe loads
This commit is contained in:
parent
5f8a166cae
commit
25253c56fc
2 changed files with 38 additions and 26 deletions
|
@ -1,18 +1,25 @@
|
|||
<script lang="ts">
|
||||
import AppContainer from "../AppContainer.svelte";
|
||||
import { Notifications } from "../../Notifications/notifications";
|
||||
import { onMount } from "svelte";
|
||||
import { gbaEmulatorBootupSequence } from "../../Sequences/sequences";
|
||||
|
||||
const handleError = () => {
|
||||
Notifications.error(
|
||||
"Failed to load the GBA Emulator app. Did you add it to the app/static/external-apps directory?"
|
||||
);
|
||||
};
|
||||
import AppContainer from '../AppContainer.svelte'
|
||||
import { Notifications } from '../../Notifications/notifications'
|
||||
import { onMount } from 'svelte'
|
||||
import { gbaEmulatorBootupSequence } from '../../Sequences/sequences'
|
||||
|
||||
onMount(() => {
|
||||
gbaEmulatorBootupSequence();
|
||||
});
|
||||
fetch('/static/external-apps/gba-emulator/index.html')
|
||||
.then((res: Response) => {
|
||||
if (!res.ok) {
|
||||
throw new Error('GBA failed to load', { cause: res })
|
||||
} else {
|
||||
gbaEmulatorBootupSequence()
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
Notifications.error(
|
||||
'Failed to load the GBA Emulator app. Did you add it to the app/static/external-apps directory?',
|
||||
{ duration: 10000 }
|
||||
)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<AppContainer useContainer={false} class="h-screen w-full">
|
||||
|
@ -21,6 +28,5 @@
|
|||
src="/static/external-apps/gba-emulator/index.html"
|
||||
class="w-full h-screen rounded-xl"
|
||||
frameborder="0"
|
||||
on:error={handleError}
|
||||
/>
|
||||
</AppContainer>
|
||||
|
|
|
@ -1,18 +1,25 @@
|
|||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import AppContainer from "../AppContainer.svelte";
|
||||
import { doomBootupSequence } from "../../Sequences/sequences";
|
||||
import { Notifications } from "../../Notifications/notifications";
|
||||
import { onMount } from 'svelte'
|
||||
import AppContainer from '../AppContainer.svelte'
|
||||
import { doomBootupSequence } from '../../Sequences/sequences'
|
||||
import { Notifications } from '../../Notifications/notifications'
|
||||
|
||||
onMount(() => {
|
||||
doomBootupSequence();
|
||||
});
|
||||
|
||||
const handleError = () => {
|
||||
Notifications.error(
|
||||
"Failed to load the Doom app. Did you add it to the app/static/external-apps directory?"
|
||||
);
|
||||
};
|
||||
fetch('/static/external-apps/jsdoom/index.html')
|
||||
.then((res: Response) => {
|
||||
if (!res.ok) {
|
||||
throw new Error('Doom failed to load', { cause: res })
|
||||
} else {
|
||||
doomBootupSequence()
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
Notifications.error(
|
||||
'Failed to load the Doom app. Did you add it to the app/static/external-apps directory?',
|
||||
{ duration: 10000 }
|
||||
)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<AppContainer>
|
||||
|
@ -21,6 +28,5 @@
|
|||
src="/static/external-apps/jsdoom/index.html"
|
||||
class="w-full h-screen rounded-xl"
|
||||
frameborder="0"
|
||||
on:error={handleError}
|
||||
/>
|
||||
</AppContainer>
|
||||
|
|
Loading…
Reference in a new issue