Pjax
Types
new Pjax(config: Config): Pjax
Use pjax.
import Pjax from 'pjax-api';
new Pjax({
areas: [
'#header, #primary',
'#container',
'body'
]
});
Config
#assign(url: string): boolean
Go to URL.
The return type means the request is accepted or not. In other words, in progress or not. Same as next.
new Pjax({}).assign('/');
#replace(url: string): boolean
Go to URL with replacing the current URL.
new Pjax({}).replace('/');
.assign(url: string, config: Config): boolean
Go to URL.
Pjax.assign('/', {});
.replace(url: string, config: Config): boolean
Go to URL with replacing the current URL.
Pjax.replace('/', {});
.sync(isPjaxPage?: boolean): void
Cancel the current page transition and sync the internal status.
You MUST call Pjax.sync after calling history.pushState and history.replaceState.
history.pushState(null, 'title', '/path');
Pjax.sync();
history.replaceState(null, 'title', '/path');
Pjax.sync(true);
.pushURL(url: string, title: string, state: any = null): void
The alias of history.pushState and Pjax.sync.
Pjax.pushURL('/path', 'title');
.replaceURL(url: string, title: string, state: any = history.state): void
The alias of history.replaceState and Pjax.sync.
Pjax.replaceURL('/path', 'title');