fix(face-landmarks) fix createImageBitMap polyfill on Safari 14
The polyfill returns an Image object instead of an ImageBitmap. The latter has a close method, however, which we call. Make sure we provide a dummy close method to avoid errors.
This commit is contained in:
parent
dd044ad252
commit
ef748c576d
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Safari polyfill for createImageBitmap
|
||||
* Safari < 15 polyfill for createImageBitmap
|
||||
* https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap
|
||||
*
|
||||
* Support source image types: Canvas.
|
||||
|
@ -16,6 +16,9 @@ if (!('createImageBitmap' in window)) {
|
|||
}
|
||||
const img = document.createElement('img');
|
||||
|
||||
// eslint-disable-next-line no-empty-function
|
||||
img.close = () => {};
|
||||
|
||||
img.addEventListener('load', () => {
|
||||
resolve(img);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue