Loaded once the browser is idle
The page was ready without it. Right after the page loaded, the browser requested it in the background: see the first response.
The placeholder of a pagelet class, loaded from the URL.
When the placeholder scrolls into view (the default).
Once the browser has nothing else to do.
The endpoint answers with the pagelet, which replaces its placeholder.
// The page gets only a placeholder: nothing is rendered yet
$comments = CommentsPagelet::lazy(
route('comments.pagelet', $post),
placeholder: '<p>Loading the comments…</p>',
);
return view('post', compact('post', 'comments'));
// The endpoint
public function comments(Post $post)
{
return (new AsyncResponse())
->pagelet(new CommentsPagelet($post))
->send();
}
The page was ready without it. Right after the page loaded, the browser requested it in the background: see the first response.
Nothing was requested for this one until its placeholder scrolled into view. Infinite scroll works the same way: see the blog of the demo app.