@curi/svelte
v2.0.0-beta.5
GitHub RepoNPM PackageAbout
This package enables you to use Curi alongside Svelte.
For more information on using Curi with Svelte, please check out the Svelte guide.
Installation
API
Router
The Router
component is used to make router related data available to components throughout the application.
Props
router
A Curi router.
Link
The Link
component is used to create an anchor for navigating to another route.
Props
name
The name of the route to link to.
params
An object of route params for the linked route.
hash
The hash for the location to link to.
query
The query for the location to link to.
state
Some (ephemeral) state associated with the location.AsyncLink
The AsyncLink
component is used to create an anchor for navigating to another route. This is similar to the the Link
, but also takes a wrapper
component for
Props
wrapper
A wrapper component to be rendered around the anchor. The wrapper will receive a navigating
prop that defaults to false
, is set to true
when a user clicks the anchor to begin a navigation, and resets to false
when the navigation completes.
For a demonstration, please check out the asynchronous navigation example.
name
The name of the route to link to.
params
An object of route params for the linked route.
hash
The hash for the location to link to.
query
The query for the location to link to.
state
Some (ephemeral) state associated with the location.Navigating
The Navigating
component is used to cancel an active asynchronous navigation.
A component is passed to Navigating
. When there is an active asynchronous navigation, the component will be given a cancel
function. When there is not an active asynchronous navigation, cancel
will be undefined
.
Props
component
A component that receives a cancel
function when there is an active asynchronous navigation.
getRouter
The getRouter
function is used to read the router
from Svelte's context.
getResponse
The getResponse
function is used to read the response
store from Svelte's context. The value will update whenever there is a new response.
getNavigation
The getNavigation
function is used to read the navigation
store from Svelte's context. The value will update whenever there is a new navigation.