https://github.com/lpreterite/imagepool
图片加载器
https://github.com/lpreterite/imagepool
Last synced: 3 months ago
JSON representation
图片加载器
- Host: GitHub
- URL: https://github.com/lpreterite/imagepool
- Owner: lpreterite
- License: mit
- Created: 2016-12-22T01:59:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-22T03:26:23.000Z (over 8 years ago)
- Last Synced: 2025-01-13T10:11:31.637Z (4 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# imagepool
图片加载器## 使用
```
var thread = 5; //最大请求链接数
var imagepool = require('/utils/imagepool').initImagePool(thread)// 加载图片列表
var sourcemap = [{
'/assets/imgs/logo.png',
'/assets/imgs/bg.jpg'
}];var finish = 0, //完成加载数
progressVal= 0; //加载进度(百分比)imagepool.load(sourcemap, {
success: function(src){
++finish
progressVal = Math.floor(finish / sourcemap.length * 100)
},
error: function(src){
console.error("error:::::"+src)
}
});
```