Skip to content

Commit

Permalink
Merge pull request #381 from kkalisz/feature/js_lifecycle
Browse files Browse the repository at this point in the history
handle lifecycle in JS targets
  • Loading branch information
Tlaster authored Sep 20, 2024
2 parents 8a57eb5 + 7d71820 commit 26b46ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.window.CanvasBasedWindow
import moe.tlaster.precompose.lifecycle.Lifecycle
import moe.tlaster.precompose.lifecycle.LifecycleOwner
import moe.tlaster.precompose.lifecycle.LifecycleRegistry
import moe.tlaster.precompose.lifecycle.LocalLifecycleOwner
Expand Down Expand Up @@ -74,4 +75,8 @@ class PreComposeWindowHolder : LifecycleOwner, BackDispatcherOwner {
override val backDispatcher by lazy {
BackDispatcher()
}

init {
lifecycle.updateState(Lifecycle.State.Active)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package moe.tlaster.precompose
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import moe.tlaster.precompose.lifecycle.Lifecycle
import moe.tlaster.precompose.lifecycle.LifecycleOwner
import moe.tlaster.precompose.lifecycle.LifecycleRegistry
import moe.tlaster.precompose.lifecycle.LocalLifecycleOwner
Expand Down Expand Up @@ -47,4 +48,8 @@ class PreComposeWindowHolder : LifecycleOwner, BackDispatcherOwner {
override val backDispatcher by lazy {
BackDispatcher()
}

init {
lifecycle.updateState(Lifecycle.State.Active)
}
}

0 comments on commit 26b46ac

Please sign in to comment.