The exendable client-side router for Alpine.js
For a more detailed list of changes and also additions which aren’t covered here, see CHANGELOG
$router now provides the PineconeRouter
object instead of the Context object
$router.context to access the context. See the above links for
the appropriate types.$params magic helper instead of $router.params$router.route with $router.context.routeredirect() method:
$router.redirect() → $router.navigate()Context.query and Context.hash, access them directly with
window.location.search/window.location.hashSee docs: Navigation History
$history magic helper for history navigation
$history.back() \ $history.canGoBack()$history.forward() \ $history.canGoForward()PineconeRouter.history to access from JS.See docs: x-handler
context.redirect() with this.$router.navigate()context.navigate, context.redirect and other functions were all removed
from the Context object.
this.$router.navigate() inside handlers to redirect.AbortController.See docs: x-template
x-template directive for inline templatespinecone-start → pinecone:startpinecone-end → pinecone:endfetch-error → pinecone:fetch-errorSee docs: Settings
PineconeRouter.Settings is now a function.
To configure:
PineconeRouter.settings({
basePath: '/app',
targetID: 'app',
})
To read:
PineconeRouter.settings().basePath
Settings.templateTargetId → Settings.targetIDSettings.interceptLinks → Settings.handleClicksSettings.alwaysSendLoadingEvents was removed, it is now default behavior.