I'm trying to create image
element dynamically and undertake other work after the element is loaded like below:
const img = new Image();
img.src = imagePath;
fromEvent(img, 'onload').subscribe(() => // do something);
But apparently, fromEvent
operator never emits with onload
event.
I saw they have discussed it in How to load images async with RxJs and perform a method when all loaded but I'd like to know if there's any other workaround to achieve this without creating an observable myself like using fromEvent
.
Any insight would be appreciated!