You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
407 B
JavaScript

"use strict";
module.exports = function awaitImageLoad(imageElement) {
// FIXME: Validation
return new Promise((resolve, reject) => {
imageElement.addEventListener("load", (_event) => {
resolve();
});
imageElement.addEventListener("error", (_event) => {
// The event does not have an actual error stored on it
reject(new Error("Could not load image")); // FIXME: Error type
});
});
};