Skip to content

Commit a9aa7fb

Browse files
committed
Use .decode()
1 parent 1bb01cf commit a9aa7fb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/ImageWorker.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ class ImageWorker extends Component<ImageWorkerProps, ImageWorkerState> {
7878
loadImage = (url: string) => {
7979
const image = new Image();
8080
this.image = image;
81-
image.onload = this.onLoad;
81+
82+
if (image.decode !== undefined)
83+
img.decode().then(this.onLoad)
84+
else
85+
image.onload = this.onLoad;
8286
image.src = url;
8387
}
8488

0 commit comments

Comments
 (0)