1
0
Fork 0
forked from OpenNeo/impress

Handle iframe outright failing to load in new item page preview

This is a nice extra error handler to have, but note that it *won't*
catch the case where the iframe successfully loads but the page returns
a bad status code. In this case, we'll just show the loading state
forever.
This commit is contained in:
Emi Matchu 2024-07-08 10:44:01 -07:00
parent fcad7e2bc9
commit 7688caebe1

View file

@ -34,6 +34,7 @@ class OutfitLayer extends HTMLElement {
} else if (iframe) {
this.iframe = iframe;
window.addEventListener("message", (m) => this.#onMessage(m));
this.iframe.addEventListener("error", () => this.#setStatus("error"));
this.#setStatus("loading");
} else {
throw new Error(`<outfit-layer> must contain an <img> or <iframe> tag`);