Lifecycle Events

SPX assumes control of the rendering cycle in your web application and provides a visit lifecycle that enables you to perform operations at different points. If you’re familiar with virtual DOM frameworks, you’ll recognize similarities with lifecycle methods. SPX draws inspiration from the renowned SPA framework, mithril.js, for lifecycle execution and offers various approaches for developers to manage renders effectively.

Lifecycle events are dispatched at various points during visit operations, providing access to contextual information in the parameters. This allows you to carry out additional operations at different stages of the SPX render cycle. If needed, events can be cancelled using preventDefault() or by returning a boolean value of false.


Execution Order

The SPX lifecycle events will be triggered in the following order of execution:

OrderEvent NameParameters
1exitPage
2prefetchPage
3visitPage
4fetchPage
5storePage
6cachePage
7renderPage
8loadPage