single-file-core 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -125,7 +125,7 @@ function triggerLazyLoading(options) {
|
|
|
125
125
|
clearAsyncTimeout("idleTimeout");
|
|
126
126
|
await setIdleTimeout(Math.max(500, delay / 2));
|
|
127
127
|
}
|
|
128
|
-
}, delay);
|
|
128
|
+
}, delay, options.loadDeferredImageNativeTimeout);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
function onResourceLoad(event) {
|
|
@@ -162,14 +162,14 @@ function triggerLazyLoading(options) {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
async function deferLazyLoadEnd(observer, options, resolve) {
|
|
165
|
-
await setAsyncTimeout("loadTimeout", () => lazyLoadEnd(observer, options, resolve), options.loadDeferredImagesMaxIdleTime);
|
|
165
|
+
await setAsyncTimeout("loadTimeout", () => lazyLoadEnd(observer, options, resolve), options.loadDeferredImagesMaxIdleTime, options.loadDeferredImageNativeTimeout);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
async function deferForceLazyLoadEnd(observer, options, resolve) {
|
|
169
169
|
await setAsyncTimeout("maxTimeout", async () => {
|
|
170
170
|
await clearAsyncTimeout("loadTimeout");
|
|
171
171
|
await lazyLoadEnd(observer, options, resolve);
|
|
172
|
-
}, options.loadDeferredImagesMaxIdleTime * 10);
|
|
172
|
+
}, options.loadDeferredImagesMaxIdleTime * 10, options.loadDeferredImageNativeTimeout);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
async function lazyLoadEnd(observer, options, resolve) {
|
|
@@ -178,12 +178,12 @@ async function lazyLoadEnd(observer, options, resolve) {
|
|
|
178
178
|
await setAsyncTimeout("endTimeout", async () => {
|
|
179
179
|
await clearAsyncTimeout("maxTimeout");
|
|
180
180
|
resolve();
|
|
181
|
-
}, options.loadDeferredImagesMaxIdleTime / 2);
|
|
181
|
+
}, options.loadDeferredImagesMaxIdleTime / 2, options.loadDeferredImageNativeTimeout);
|
|
182
182
|
observer.disconnect();
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
async function setAsyncTimeout(type, callback, delay) {
|
|
186
|
-
if (browser && browser.runtime && browser.runtime.sendMessage) {
|
|
185
|
+
async function setAsyncTimeout(type, callback, delay, forceNativeTimeout) {
|
|
186
|
+
if (browser && browser.runtime && browser.runtime.sendMessage && !forceNativeTimeout) {
|
|
187
187
|
if (!timeouts.get(type) || !timeouts.get(type).pending) {
|
|
188
188
|
const timeoutData = { callback, pending: true };
|
|
189
189
|
timeouts.set(type, timeoutData);
|
package/single-file.js
CHANGED
|
@@ -42,7 +42,9 @@ export {
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
function init(initOptions) {
|
|
45
|
-
SingleFile
|
|
45
|
+
if (typeof SingleFile == "undefined") {
|
|
46
|
+
SingleFile = core.getClass(util.getInstance(initOptions), vendor.cssTree);
|
|
47
|
+
}
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
async function getPageData(options = {}, initOptions, doc = globalThis.document, win = globalThis) {
|