Last active
June 9, 2023 14:55
-
-
Save saqib-github-commits/a551d51f4fbdd150116217f0a4e67056 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val lifecycleOwner = LocalLifecycleOwner.current | |
DisposableEffect(lifecycleOwner) { | |
val lifecycleEventObserver = LifecycleEventObserver { _, event -> | |
// event contains current lifecycle event | |
} | |
lifecycleOwner.lifecycle.addObserver(lifecycleEventObserver) | |
onDispose { | |
lifecycleOwner.lifecycle.removeObserver(lifecycleEventObserver) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment