shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
whenImagesLoaded
Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.when
Detect when some images are loaded. This function take advantage of the SPromise class and trigger an event called “img.loaded” that will be triggered on each loaded images and another called “loaded” once all the images are loaded. See in the example bellow.
Params
- $imgs*-Array<HTMLImageElement>
An array (or nodeList) of HTMLImageElement to detect the load
Return
- -Promise
A promise resolved when all images are loaded properly
Example
import { whenImagesLoaded } from '@blackbyte/sugar/dom'
whenImagesLoaded([
$img1, $img2, $img3
]).then(imgs => {
// do something here
})Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space