Events
During all the lifecycle of the page transition, barba will emit a series of events, with useful information:
Name | Arguments | When |
---|---|---|
linkClicked |
HTMLElement , MouseEvent |
The user click on a link elegible for PJAX. |
initStateChange |
currentStatus |
The link has just been changed. |
newPageReady |
currentStatus , prevStatus , HTMLElementContainer , newPageRawHTML |
The new container has been loaded and injected in the wrapper. |
transitionCompleted |
currentStatus [, prevStatus ] |
The transition has just finished and the old Container has been removed from the DOM. |
currentStatus
andprevStatus
are plain objects with the url of the page and eventually the namespace.
To listen for an event, it's as simple as: