@wcstack/fetch 4.24.0 → 4.24.1
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/README.ja.md +1 -0
- package/README.md +1 -0
- package/dist/auto.min.js +1 -1
- package/dist/auto.min.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.esm.js +23 -8
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -457,6 +457,15 @@ declare class InfiniteScroll extends HTMLElement {
|
|
|
457
457
|
attributeChangedCallback(): void;
|
|
458
458
|
private _observe;
|
|
459
459
|
private _disconnectObserver;
|
|
460
|
+
/** The observer's report: the last entry is the sentinel's state now, and coming on screen runs the request. */
|
|
461
|
+
private _report;
|
|
462
|
+
/**
|
|
463
|
+
* Takes the reports the browser has made and not delivered yet, before the sentinel's state is read outside a
|
|
464
|
+
* report. While the user scrolls, the report that a page pushed the sentinel out arrives a frame later than
|
|
465
|
+
* otherwise — after the frames the end of a request waits (Chromium, Firefox): the sentinel read as still on
|
|
466
|
+
* screen, and a page the window did not need was asked for (docs/seam-apps.md, landing town-archive).
|
|
467
|
+
*/
|
|
468
|
+
private _sync;
|
|
460
469
|
/**
|
|
461
470
|
* The scroll container: the element with that id, or — as `<wcs-intersect root>` spells it — the first one the
|
|
462
471
|
* value matches as a selector. A root that is given and not found, or that does not scroll, is said once per
|
package/dist/index.esm.js
CHANGED
|
@@ -68,7 +68,7 @@ function setConfig(partialConfig) {
|
|
|
68
68
|
frozenConfig = null;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
var pkg = {"name":"@wcstack/fetch","version":"4.24.
|
|
71
|
+
var pkg = {"name":"@wcstack/fetch","version":"4.24.1"};
|
|
72
72
|
|
|
73
73
|
// ===========================================================================
|
|
74
74
|
// AUTO-GENERATED FILE - DO NOT EDIT.
|
|
@@ -1854,13 +1854,7 @@ class InfiniteScroll extends HTMLElement {
|
|
|
1854
1854
|
}
|
|
1855
1855
|
this._rootElement = this._resolveRoot();
|
|
1856
1856
|
try {
|
|
1857
|
-
this._observer = new IntersectionObserver((entries) => {
|
|
1858
|
-
// the last entry is the sentinel's state now
|
|
1859
|
-
this._inView = entries[entries.length - 1].isIntersecting;
|
|
1860
|
-
if (this._inView) {
|
|
1861
|
-
this._run(true);
|
|
1862
|
-
}
|
|
1863
|
-
}, {
|
|
1857
|
+
this._observer = new IntersectionObserver((entries) => this._report(entries), {
|
|
1864
1858
|
root: this._rootElement,
|
|
1865
1859
|
rootMargin: this.rootMargin,
|
|
1866
1860
|
// (out of 0..1 the browser throws: only the margin is left to refuse)
|
|
@@ -1888,6 +1882,25 @@ class InfiniteScroll extends HTMLElement {
|
|
|
1888
1882
|
}
|
|
1889
1883
|
this._inView = false;
|
|
1890
1884
|
}
|
|
1885
|
+
/** The observer's report: the last entry is the sentinel's state now, and coming on screen runs the request. */
|
|
1886
|
+
_report(entries) {
|
|
1887
|
+
this._inView = entries[entries.length - 1].isIntersecting;
|
|
1888
|
+
if (this._inView) {
|
|
1889
|
+
this._run(true);
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Takes the reports the browser has made and not delivered yet, before the sentinel's state is read outside a
|
|
1894
|
+
* report. While the user scrolls, the report that a page pushed the sentinel out arrives a frame later than
|
|
1895
|
+
* otherwise — after the frames the end of a request waits (Chromium, Firefox): the sentinel read as still on
|
|
1896
|
+
* screen, and a page the window did not need was asked for (docs/seam-apps.md, landing town-archive).
|
|
1897
|
+
*/
|
|
1898
|
+
_sync() {
|
|
1899
|
+
const pending = this._observer ? this._observer.takeRecords() : [];
|
|
1900
|
+
if (pending.length > 0) {
|
|
1901
|
+
this._report(pending);
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1891
1904
|
/**
|
|
1892
1905
|
* The scroll container: the element with that id, or — as `<wcs-intersect root>` spells it — the first one the
|
|
1893
1906
|
* value matches as a selector. A root that is given and not found, or that does not scroll, is said once per
|
|
@@ -1981,6 +1994,7 @@ class InfiniteScroll extends HTMLElement {
|
|
|
1981
1994
|
if (!this._settling)
|
|
1982
1995
|
return;
|
|
1983
1996
|
this._settling = false;
|
|
1997
|
+
this._sync();
|
|
1984
1998
|
if (this._inView && (this._changedInFlight || !this._answered || this._position() !== this._startedAt)) {
|
|
1985
1999
|
this._run(false);
|
|
1986
2000
|
}
|
|
@@ -2004,6 +2018,7 @@ class InfiniteScroll extends HTMLElement {
|
|
|
2004
2018
|
return;
|
|
2005
2019
|
}
|
|
2006
2020
|
afterFrames(2, () => {
|
|
2021
|
+
this._sync();
|
|
2007
2022
|
if (this._inView)
|
|
2008
2023
|
this._run(false);
|
|
2009
2024
|
});
|