mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
[ci] format
This commit is contained in:
parent
4bc360cd5f
commit
718eed704a
1 changed files with 6 additions and 6 deletions
|
@ -625,7 +625,7 @@ if (inBrowser) {
|
||||||
if ('onscrollend' in window) addEventListener('scrollend', onScrollEnd);
|
if ('onscrollend' in window) addEventListener('scrollend', onScrollEnd);
|
||||||
else {
|
else {
|
||||||
// Keep track of state between intervals
|
// Keep track of state between intervals
|
||||||
let intervalId: number | undefined, lastY: number, lastX: number, lastIndex: State["index"];
|
let intervalId: number | undefined, lastY: number, lastX: number, lastIndex: State['index'];
|
||||||
const scrollInterval = () => {
|
const scrollInterval = () => {
|
||||||
// Check the index to see if a popstate event was fired
|
// Check the index to see if a popstate event was fired
|
||||||
if (lastIndex !== history.state?.index) {
|
if (lastIndex !== history.state?.index) {
|
||||||
|
@ -642,20 +642,20 @@ if (inBrowser) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// Update vars with current positions
|
// Update vars with current positions
|
||||||
lastY = scrollY, lastX = scrollX;
|
(lastY = scrollY), (lastX = scrollX);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
// We can't know when or how often scroll events fire, so we'll just use them to start intervals
|
// We can't know when or how often scroll events fire, so we'll just use them to start intervals
|
||||||
addEventListener(
|
addEventListener(
|
||||||
"scroll",
|
'scroll',
|
||||||
() => {
|
() => {
|
||||||
if (intervalId !== undefined) return;
|
if (intervalId !== undefined) return;
|
||||||
lastIndex = history.state.index, lastY = scrollY, lastX = scrollX;
|
(lastIndex = history.state.index), (lastY = scrollY), (lastX = scrollX);
|
||||||
intervalId = window.setInterval(scrollInterval, 50);
|
intervalId = window.setInterval(scrollInterval, 50);
|
||||||
},
|
},
|
||||||
{ passive: true }
|
{ passive: true }
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
for (const script of document.scripts) {
|
for (const script of document.scripts) {
|
||||||
script.dataset.astroExec = '';
|
script.dataset.astroExec = '';
|
||||||
|
|
Loading…
Add table
Reference in a new issue