operator
operator copied to clipboard
Route lifecycle
Hi,
I think it would be very useful if the route handler could have an asynchronous lifecycle out of the box.
Greate little lib, by the way, thanks.
At the moment the only way seems to use some ugly logical methods, like:
{
path: '/blog/:post',
handler () {
let loaded = false;
app.on('after', () => {
if (!loaded) {
loaded = true;
Slider.init();
}
})
}
}
But having something like: state.beforeLoad, state.afterLoad would come in very handy for manipulating DOM and destroying events.