From 7dd8aaecf982caea709aeaeebaa77ccde910bbbe Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Sun, 22 Dec 2024 00:15:43 +0100 Subject: [PATCH] Fix image.decode() return --- slides.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slides.md b/slides.md index 16ed8c3..46521a3 100644 --- a/slides.md +++ b/slides.md @@ -685,7 +685,7 @@ const source = new Source({ loader(z, x, y, {signal}) { const image = new Image(); image.src = `${z}/${x}/${y}.png`}; - return image.decode(); + return image.decode().then(() => createImageBitmap(image)); } }); ``` @@ -710,7 +710,7 @@ const source = new Source({ bbox: extent.join(','), }); image.src = `map?crs=[EPSG:3857]&scale-denominator=1&${query.toString()}`; - return {image: image.decode(), pixelRatio: 1}; + return {image: image.decode().then(() => createImageBitmap(image)), pixelRatio: 1}; } }); ```