Skip to content

Commit

Permalink
fix: non string hook id breaks router
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSharkov committed Feb 11, 2022
1 parent 9c0088f commit f842ada
Show file tree
Hide file tree
Showing 4 changed files with 1,195 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ Simple example of using a hook:
import {onDestroy} from 'svelte'
import router from './router'
const testHookID = 'test-hook'
const removeBeforePushHook = router.addBeforePushHook(
testHookID,
({location, pendingRoute, resolve, reject})=> {
if (pendingRoute.name === '/very/secret/path') {
reject()
Expand All @@ -319,6 +321,8 @@ Simple example of using a hook:
onDestroy(()=> {
removeBeforePushHook()
// or
// router.removeBeforePush(testHookID)
})
</script>
```
Expand Down
Loading

0 comments on commit f842ada

Please sign in to comment.