|
|
@@ -33,12 +33,6 @@ this.lazyLoader = this.lazyLoader || (() => {
|
|
|
function process(options) {
|
|
|
return new Promise(async resolve => {
|
|
|
let timeoutId, srcAttributeChanged;
|
|
|
- const idleTimeoutId = await setTimeout(() => {
|
|
|
- if (!srcAttributeChanged) {
|
|
|
- clearTimeout(timeoutId);
|
|
|
- lazyLoadEnd(maxTimeoutId, idleTimeoutId, observer, options, resolve);
|
|
|
- }
|
|
|
- }, options.maxLazyLoadImagesIdleTime * 1.2);
|
|
|
const maxTimeoutId = await setTimeout(() => {
|
|
|
clearTimeout(timeoutId);
|
|
|
lazyLoadEnd(maxTimeoutId, idleTimeoutId, observer, options, resolve);
|
|
|
@@ -56,6 +50,12 @@ this.lazyLoader = this.lazyLoader || (() => {
|
|
|
}
|
|
|
});
|
|
|
observer.observe(document, { attributeFilter: MONITORED_ATTRIBUTES, subtree: true, childList: true, attributes: true });
|
|
|
+ const idleTimeoutId = await setTimeout(() => {
|
|
|
+ if (!srcAttributeChanged) {
|
|
|
+ clearTimeout(timeoutId);
|
|
|
+ lazyLoadEnd(maxTimeoutId, idleTimeoutId, observer, options, resolve);
|
|
|
+ }
|
|
|
+ }, options.maxLazyLoadImagesIdleTime * 1.2);
|
|
|
injectScript(SCRIPT_BEFORE_PATH);
|
|
|
});
|
|
|
}
|