isDynamicPageReloadEnabled(): void¶
The isDynamicPageReloadEnabled
method allows to check if Turbo's dynamic page reload is currently in the scope and enabled. Find out more about the dynamic page reload here.
Returned value¶
A returned value has a type of boolean
.
Example¶
In this example we make a PageManagerApi
call to check if dynamic page reload is currently enabled. If it is then we will set an event listener for the turbo:load
event.
useStorefront(async (storefront) => {
const pageManagerApi = storefront.getApiSync('PageManagerApi');
if (pageManagerApi.isDynamicPageReloadEnabled()) {
document.addEventListener('turbo:load', (event) => {
// do something
});
}
});