Skip to content

Commit 0f70ef9

Browse files
updated: documentation
1 parent 3434e4c commit 0f70ef9

File tree

2 files changed

+42
-12
lines changed

2 files changed

+42
-12
lines changed

README.md

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Modern images loader helpers written in es2015 using generators and promises
1010
## Usage
1111

1212
#### Load a single image
13+
1314
```js
1415
import { loadImage } from 'bianco.images-loader'
1516

@@ -42,7 +43,6 @@ loadImages([
4243
.catch(error => {
4344
// there was an error loading one of images
4445
})
45-
4646
```
4747

4848
Or also...
@@ -56,7 +56,6 @@ loadImages($('img', '.main-content'))
5656
.catch(error => {
5757
// there was an error loading one of images
5858
})
59-
6059
```
6160

6261
#### Lazy load sequentially images using a generator
@@ -88,18 +87,48 @@ for (let promise of infiniteList) {
8887
}
8988
```
9089

90+
[travis-image]: https://img.shields.io/travis/biancojs/images-loader.svg?style=flat-square
91+
92+
[travis-url]: https://travis-ci.org/biancojs/images-loader
93+
94+
[license-image]: http://img.shields.io/badge/license-MIT-000000.svg?style=flat-square
95+
96+
[license-url]: LICENSE.txt
97+
98+
[npm-version-image]: http://img.shields.io/npm/v/bianco.images-loader.svg?style=flat-square
99+
100+
[npm-downloads-image]: http://img.shields.io/npm/dm/bianco.images-loader.svg?style=flat-square
101+
102+
[npm-url]: https://npmjs.org/package/bianco.images-loader
103+
91104
## API
92105

93-
- `loadImage(String|Image)` load an image returning a promise
94-
- `loadImages(Array|NodeList)` load in parallel multiple images returning a promise
95-
- `loadImagesGen(Array|NodeList)` load multiple images sequentially returning a ES6 generator
106+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
107+
108+
### loadImage
109+
110+
Preload any image
111+
112+
**Parameters**
113+
114+
- `img` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [HTMLElement](https://developer.mozilla.org/en-US/docs/Web/HTML/Element))** Path to the image or image object
115+
116+
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** a promise that will be resolved when the image will be completely loaded
117+
118+
### loadImages
119+
120+
Load in parallel a collection of images
121+
122+
**Parameters**
123+
124+
- `imgs` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList))** array of strings or <img> HTML elements
125+
126+
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** a promise that will be resolved when all the images will be loaded
127+
128+
### loadImagesGen
96129

97-
[travis-image]:https://img.shields.io/travis/biancojs/images-loader.svg?style=flat-square
98-
[travis-url]:https://travis-ci.org/biancojs/images-loader
130+
Load sequentially a collection of images
99131

100-
[license-image]:http://img.shields.io/badge/license-MIT-000000.svg?style=flat-square
101-
[license-url]:LICENSE.txt
132+
**Parameters**
102133

103-
[npm-version-image]:http://img.shields.io/npm/v/bianco.images-loader.svg?style=flat-square
104-
[npm-downloads-image]:http://img.shields.io/npm/dm/bianco.images-loader.svg?style=flat-square
105-
[npm-url]:https://npmjs.org/package/bianco.images-loader
134+
- `imgs` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList))** array of strings or <img> HTML elements

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"prepublish": "npm run build && npm test",
99
"lint": "eslint index.next.js test.js rollup.config.js",
1010
"build": "rollup -c",
11+
"doc": "documentation readme index.next.js -s API",
1112
"test": "npm run lint && mocha test.js"
1213
},
1314
"files": [

0 commit comments

Comments
 (0)