summaryrefslogtreecommitdiff
path: root/game.js
diff options
context:
space:
mode:
Diffstat (limited to 'game.js')
-rw-r--r--game.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/game.js b/game.js
index 6d3cbb0..e558cd2 100644
--- a/game.js
+++ b/game.js
@@ -347,16 +347,17 @@ window.addEventListener('load', function () {
draggingPieceLastPos.y = e.clientY;
}
});
- async function loadImage() {
+ function loadImage() {
document.body.style.setProperty('--image', `url("${imageUrl}")`);
imageLinkElement.style.visibility = 'visible';
imageLinkElement.href = imageLink;
- image.src = imageUrl;
- await new Promise((resolve) => {
+ const promise = new Promise((resolve) => {
image.addEventListener('load', function () {
resolve();
});
});
+ image.src = imageUrl;
+ return promise;
}
function updateConnectivity(connectivity) {
console.assert(connectivity.length === pieces.length);