Przeglądaj źródła

added async/await to avoid side effects

Gildas 7 lat temu
rodzic
commit
a81699ca52
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      lib/lazy/content/content-lazy-loader.js

+ 2 - 2
lib/lazy/content/content-lazy-loader.js

@@ -53,9 +53,9 @@ this.lazyLoader = this.lazyLoader || (() => {
 				}
 			});
 			observer.observe(document, { subtree: true, childList: true, attributes: true });
-			const idleTimeoutId = await setTimeout(() => {
+			const idleTimeoutId = await setTimeout(async () => {
 				if (!srcAttributeChanged) {
-					clearTimeout(timeoutId);
+					await clearTimeout(timeoutId);
 					lazyLoadEnd(maxTimeoutId, idleTimeoutId, observer, options, resolve);
 				}
 			}, options.maxLazyLoadImagesIdleTime * 1.2);