Skip to content

Commit 6ce110c

Browse files
committed
update README.md to reflect new hook naming change
1 parent a0de19f commit 6ce110c

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ yarn add svelte-transitioner
2020
This plugin adds the following hooks:
2121
- `onGlobalInit`: a hook responsible for executing custom code when mounting any of the child components
2222
- `onInit`: a hook responsible for executing custom code on the current component
23-
- `onGlobalEnter`: a hook that can execute the same custom transition when mounting any of the child components
24-
- `onEnter`: a hook that can execute a transition when mounting a component
25-
- `onGlobalLeave`: a hook that can execute the same custom transition when unmounting any of the child components
26-
- `onLeave`: a hook that can execute a transition when unmounting a component
23+
- `globalIntro`: a hook that can execute the same custom transition when mounting any of the child components
24+
- `intro`: a hook that can execute a transition when mounting a component
25+
- `globalOutro`: a hook that can execute the same custom transition when unmounting any of the child components
26+
- `outro`: a hook that can execute a transition when unmounting a component
2727

2828
for the `on*Init` hooks, they will be called like the following:
2929
```Javascript
3030
onInit((node) => {
3131
// node is the current mounted node
3232
})
3333
```
34-
as for the `on*Enter` or `on*Leave`, it can be called in two ways:
34+
as for the `*intro` or `*outro` callbacks, it can be used in two ways:
3535
```Javascript
36-
onEnter((node, t) => {
36+
intro((node, t) => {
3737
// node is the current mounted node
3838
// t is the current transition animation
3939
// 1000 is the duration of the transition
4040
}, 1000)
4141

4242
// Or you can use a GSAP Timeline callback instead, like the following
43-
onGlobalEnter((node) => {
43+
intro((node) => {
4444
const tl = gsap.timeline({
4545
paused: true
4646
})
@@ -63,15 +63,15 @@ So for example in a SvelteKit project, we can have the following:
6363
`/routes/__layout.svelte`:
6464
```Svelte
6565
<script>
66-
import { onGlobalInit, onGlobalEnter, onGlobalLeave, TransitionLayout } from 'svelte-transitioner'
66+
import { onGlobalInit, globalIntro, globalOutro, TransitionLayout } from 'svelte-transitioner'
6767
6868
onGlobalInit((node) => {
6969
7070
})
71-
onGlobalEnter((node) => {
71+
globalIntro((node) => {
7272
return gsap.timeline({ paused: true })
7373
})
74-
onGlobalLeave((node, t) => {
74+
globalOutro((node, t) => {
7575
7676
})
7777
</script>
@@ -82,15 +82,15 @@ So for example in a SvelteKit project, we can have the following:
8282
`/routes/index.svelte`:
8383
```Svelte
8484
<script>
85-
import { onInit, onEnter, onLeave, Transitioner } from 'svelte-transitioner'
85+
import { onInit, intro, outro, Transitioner } from 'svelte-transitioner'
8686
8787
onInit((node) => {
8888
8989
})
90-
onEnter((node) => {
90+
intro((node) => {
9191
return gsap.timeline({ paused: true })
9292
})
93-
onLeave((node, t) => {
93+
outro((node, t) => {
9494
9595
})
9696
</script>
@@ -102,15 +102,15 @@ So for example in a SvelteKit project, we can have the following:
102102
`/routes/one.svelte`:
103103
```Svelte
104104
<script>
105-
import { onInit, onEnter, onLeave, Transitioner } from 'svelte-transitioner'
105+
import { onInit, intro, outro, Transitioner } from 'svelte-transitioner'
106106
107107
onInit((node) => {
108108
109109
})
110-
onEnter((node) => {
110+
intro((node) => {
111111
return gsap.timeline({ paused: true })
112112
})
113-
onLeave((node, t) => {
113+
outro((node, t) => {
114114
115115
})
116116
</script>

0 commit comments

Comments
 (0)