()
| 392 | } |
| 393 | } else { |
| 394 | const onLoad = () => { |
| 395 | // eslint-disable-next-line @typescript-eslint/no-use-before-define |
| 396 | off($image, EVENT_ERROR, onError); |
| 397 | |
| 398 | // Ensure the image is fully rendered. |
| 399 | setTimeout(() => { |
| 400 | resolve($image); |
| 401 | }); |
| 402 | }; |
| 403 | const onError = () => { |
| 404 | off($image, EVENT_LOAD, onLoad); |
| 405 | reject(error); |