What is a Renderer and how to implement one
mainA Renderer is a class that runs every time a page is shown or hidden in Taxi. They are used for initializing or destroying components, playing intro animations, or managing page-specific logic.
To create a Renderer, extend the @unseenco/taxi.Renderer class and implement the lifecycle methods. Within these methods, you have access to the following properties:
this.page: The entire document being rendered.this.title: Thedocument.titleof the page.this.wrapper: A reference to thedata-taxielement.this.content: A reference to thedata-taxi-viewelement being added to the DOM.
import { Renderer } from '@unseenco/taxi';
export default class CustomRenderer extends Renderer {
onEnter() {
// run after the new content has been added to the Taxi container
}
onEnterCompleted() {
// run after the transition.onEnter has fully completed
}
onLeave() {
// run before the transition.onLeave method is called
}
onLeaveCompleted() {
// run after the transition.onleave has fully completed
}
}