Skip to content

Commit 6c22413

Browse files
committed
Update docs with LifecycleEffectOnce onDispose
1 parent 6103d3a commit 6c22413

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/lifecycle.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
** Experimental API
44

5-
Inside a `Screen`, you can call `LifecycleEffectOnce` to execute a block of code the first time the Screen appears:
5+
Inside a `Screen`, you can call `LifecycleEffectOnce` to execute a block of code the first time the Screen appears,
6+
and optionally define a `onDispose` callback for when the Screen is leaving/removed from the Stack:
67

78
```kotlin
89
class PostListScreen : Screen {
@@ -11,6 +12,9 @@ class PostListScreen : Screen {
1112
override fun Content() {
1213
LifecycleEffectOnce {
1314
screenModel.initSomething()
15+
onDispose {
16+
// Do something when the screen is leaving/removed from the Stack
17+
}
1418
}
1519

1620
// ...

0 commit comments

Comments
 (0)