Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrameLifecycleAware ¶ added in v0.1.94
type FrameLifecycleAware interface {
StartFrame()
EndFrame()
}
type HasCoroutineScope ¶ added in v0.1.94
type HasCoroutineScope interface {
// SetCoroutineScope provides a context that is cancelled when the remembered value is leaving the composition.
// This is analogous to viewModelScope in Kotlin, which is a CoroutineScope.
SetCoroutineScope(ctx context.Context)
}
HasCoroutineScope is an optional interface for ViewModels that need a managed context/scope. When a Remembered value implements this interface, it will receive a context that is cancelled when the leaving the composition.
type HasViewModelScope ¶
type HasViewModelScope interface {
// SetViewModelScope provides a context that is cancelled when the ViewModel is cleared.
// This is analogous to viewModelScope in Kotlin, which is a CoroutineScope.
SetViewModelScope(ctx context.Context)
}
HasViewModelScope is an optional interface for ViewModels that need a managed context/scope. When a ViewModel implements this interface, it will receive a context that is cancelled when the ViewModel is cleared, enabling graceful shutdown of goroutines.
type RememberObserver ¶
type RememberObserver interface {
// OnForgotten is called when the object is no longer being remembered.
// This happens when the remember call is removed from composition.
OnForgotten()
}
RememberObserver is an interface for objects that need lifecycle callbacks when remembered in composition. This is the Go equivalent of androidx.compose.runtime.RememberObserver.
type ViewModel ¶
type ViewModel interface {
// OnCleared is called when the ViewModel is no longer used and is being destroyed.
// Use this to clean up resources such as cancelling background tasks or closing connections.
OnCleared()
}
ViewModel is an interface that ViewModels can implement to be notified when they are cleared. In Android/Kotlin, ViewModel.onCleared() is called when the ViewModel is no longer used.