Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Adds example to goto documentation #1055

Merged
merged 5 commits into from
Feb 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion site/content/docs/03-client-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,20 @@ sapper.start({

Programmatically navigates to the given `href`. If the destination is a Sapper route, Sapper will handle the navigation, otherwise the page will be reloaded with the new `href`. In other words, the behaviour is as though the user clicked on a link with this `href`.

Returns a `Promise` that resolves when the navigation is complete.
Returns a `Promise` that resolves when the navigation is complete. This can be used to perform actions once the navigation has completed, such as updating a database, store, etc.

```js
import { goto } from '@sapper/app';

const navigateAndSave = async () => {
await goto('/');
saveItem();
}

const saveItem = () => {
// do something with the database
}
```


### prefetch(href)
Expand Down