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.route
redirect()
method:
$router.redirect()
→ $router.navigate()
Context.query
and Context.hash
, access them directly with
window.location.search
/window.location.hash
See 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:start
pinecone-end
→ pinecone:end
fetch-error
→ pinecone:fetch-error
See docs: Settings
PineconeRouter.Settings is now a function.
To configure:
PineconeRouter.settings({
basePath: '/app',
targetID: 'app',
})
To read:
PineconeRouter.settings().basePath
Settings.templateTargetId
→ Settings.targetID
Settings.interceptLinks
→ Settings.handleClicks
Settings.alwaysSendLoadingEvents
was removed, it is now default behavior.