SaveBehavior

sealed interface SaveBehavior

An interface that specifies when saveStatePlugin is going to save the store's state. Multiple variants can be used, but there are restrictions on how you can combine them (see saveStatePlugin documentation for more details).

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class OnChange(val delay: Duration = DefaultDelayMs.milliseconds) : SaveBehavior

A saving behavior that saves the state when after it has changed. The newest state will be saved. (i.e. the state the store has after the delay has passed. The delay will be reset and previous state save job will be canceled if state changes again.

Link copied to clipboard
data class OnUnsubscribe(val remainingSubscribers: Int = 0) : SaveBehavior

A saving behavior that saves the state when remainingSubscribers count drops below the specified amount.