@@ -13,12 +13,7 @@ Modern images loader helpers written in es2015 using generators and promises
13
13
``` js
14
14
import { loadImage } from ' bianco.images-loader'
15
15
16
- loadImage (' path/to/the/image.jpg' )
17
- .then (img => document .body .appendChild (img))
18
- .catch (function (error ) {
19
- // there was an error loading the image
20
- })
21
-
16
+ loadImage (' path/to/the/image.jpg' ).then (img => document .body .appendChild (img))
22
17
```
23
18
24
19
Or also DOM nodes:
@@ -27,7 +22,11 @@ Or also DOM nodes:
27
22
import $ from ' bianco.query'
28
23
import { loadImage } from ' bianco.images-loader'
29
24
30
- loadImage ($ (' img.cool' )).then (img => img .classList .add (' loaded' ))
25
+ loadImage ($ (' img.cool' ))
26
+ .then (img => img .classList .add (' loaded' ))
27
+ .catch (function (error ) {
28
+ // there was an error loading the image
29
+ })
31
30
```
32
31
33
32
#### Load a multiple images
@@ -36,9 +35,9 @@ loadImage($('img.cool')).then(img => img.classList.add('loaded'))
36
35
import { loadImages } from ' bianco.images-loader'
37
36
38
37
loadImages ([
39
- ' path/to/the/image1.jpg' ,
40
- ' path/to/the/image2.jpg'
41
- ])
38
+ ' path/to/the/image1.jpg' ,
39
+ ' path/to/the/image2.jpg'
40
+ ])
42
41
.then (img => document .body .appendChild (img))
43
42
.catch (error => {
44
43
// there was an error loading one of images
0 commit comments