Poll Helper
Polling your server for new information on the current page is common, so Inertia provides a helper to reduce boilerplate. It automatically stops polling when the page is unmounted. The only required argument is the polling interval in milliseconds.router.reload options as the second parameter.
stop and start methods that allow you to manually start and stop polling. You can pass the autoStart: false option to the poll helper to prevent it from automatically starting polling when the component is mounted.
polling value that reflects whether the poll is running, making it ideal for rendering a pause or resume button. The value doesn’t indicate whether a request is in flight.
Concurrency Mode
By default, the poll helper fires a new request on every tick, even when the previous request is still in flight. You may control this behavior with themode option, which accepts one of three values: overlap, cancel, or rest.
The default overlap mode allows requests to run in parallel. The cancel mode aborts any in-flight request when the next tick fires. The rest mode treats the interval as the time between the end of the previous request and the start of the next one, so requests never overlap.
Background Tabs
v3.9.0+ By default, the poll helper throttles requests by 90% when the browser tab is in the background. You may control this behavior with thebackground option, which accepts one of three values: throttle, pause, or continue.
The pause mode stops polling entirely while the tab is hidden. Once the tab becomes visible again, polling resumes, firing a request immediately if the interval has already elapsed since the last one. The continue mode keeps polling at the regular interval, even while the tab is hidden.
The
keepAlive option is deprecated in favor of background: 'continue'.