Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle lifecycle in JS targets #381

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}