Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_loadImage() {
const items = this.state.items.filter(item => {
const loaded = item.loaded !== NOT_LOADED;
return !loaded;
});
if (!items.length) {
this.state.render = REQUEST_RENDER;
this.layout();
return;
}
const elements = items.map(item => item.el);
items.forEach(item => item.loaded = LOADING);
ImageLoaded.check(elements, {
type: this.props.isEqualSize && this.state.items[0].size.width ? CHECK_ONLY_ERROR : CHECK_ALL,
complete: () => {
if (!this._container) {
return;
}
let size;
items.forEach(item => {
item.loaded = LOADED;
item.updateSize(size);
if (this.props.isEqualSize && !size) {
size = {...this.state.items[0].size};
}
});
this.state.render = REQUEST_RENDER;
this.layout();
},