Skip to content

Commit

Permalink
Updated docs and types
Browse files Browse the repository at this point in the history
  • Loading branch information
ItalyPaleAle authored Jun 17, 2021
1 parent 5febf15 commit 42f8431
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Advanced Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ event.detail = {
location: '/book/343',
// The "querystring" from the page's hash, equivalent to the value of the $querystring readable store
querystring: 'foo=bar',
// Params matched from the route (such as :id from the route)
params: { id: '343' },
// User data passed with the wrap function; can be any kind of object/dictionary
userData: {...}
}
Expand Down Expand Up @@ -405,10 +407,11 @@ function routeLoading(event) {
function routeLoaded(event) {
console.log('routeLoaded event')
// The first 4 properties are the same as for the routeLoading event
// The first 5 properties are the same as for the routeLoading event
console.log('Route', event.detail.route)
console.log('Location', event.detail.location)
console.log('Querystring', event.detail.querystring)
console.log('Params', event.detail.params)
console.log('User data', event.detail.userData)
// The last two properties are unique to routeLoaded
console.log('Component', event.detail.component) // This is a Svelte component, so a function
Expand Down
3 changes: 3 additions & 0 deletions Router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export interface RouteDetail {
/** Querystring from the hash */
querystring: string

/** Params matched in the route */
params: Record<string, string> | null

/** Custom data passed by the user */
userData?: object
}
Expand Down

0 comments on commit 42f8431

Please sign in to comment.