|
5 | 5 | [![NPM downloads][npm-downloads-image]][npm-url]
|
6 | 6 | [![MIT License][license-image]][license-url]
|
7 | 7 |
|
8 |
| -Modern images loader helpers written in es2015 using generators and promises |
| 8 | +Modern images loader helpers written in es2015 using promises |
9 | 9 |
|
10 | 10 | ## Usage
|
11 | 11 |
|
@@ -58,35 +58,6 @@ loadImages($('img', '.main-content'))
|
58 | 58 | })
|
59 | 59 | ```
|
60 | 60 |
|
61 |
| -#### Lazy load sequentially images using a generator |
62 |
| - |
63 |
| -```js |
64 |
| -import { loadImagesGen } from 'bianco.images-loader' |
65 |
| - |
66 |
| -const infiniteList = loadImagesGen([...many images]) |
67 |
| - |
68 |
| -// load the first 10 images |
69 |
| -let i = 10 |
70 |
| -while (i--) { |
71 |
| - infiniteList.next().value.then(onImageLoaded) |
72 |
| -} |
73 |
| - |
74 |
| -// do something |
75 |
| - |
76 |
| -// load other 5 images |
77 |
| -i = 5 |
78 |
| -while (i--) { |
79 |
| - infiniteList.next().value.then(onImageLoaded) |
80 |
| -} |
81 |
| - |
82 |
| -// do something else |
83 |
| - |
84 |
| -// load the remaining images |
85 |
| -for (let promise of infiniteList) { |
86 |
| - promise.next().value.then(onImageLoaded) |
87 |
| -} |
88 |
| -``` |
89 |
| - |
90 | 61 | [travis-image]: https://img.shields.io/travis/biancojs/images-loader.svg?style=flat-square
|
91 | 62 |
|
92 | 63 | [travis-url]: https://travis-ci.org/biancojs/images-loader
|
@@ -124,11 +95,3 @@ Load in parallel a collection of images
|
124 | 95 | - `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 | 96 |
|
126 | 97 | 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 |
129 |
| - |
130 |
| -Load sequentially a collection of images |
131 |
| - |
132 |
| -**Parameters** |
133 |
| - |
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 |
0 commit comments