StateLoader
object StateLoader
Value members
Concrete methods
State depends on deviceId and HTTP-request. Second one could be None if case when user reconnected to restarted application and state wasn't restored.
State depends on deviceId and HTTP-request. Second one could be None if case when user reconnected to restarted application and state wasn't restored.
State is same for all sessions.
State is same for all sessions.
- Type parameters:
- S
Type of state
- Value parameters:
- initialState
State factory
State depends on deviceId. Useful when you want to restore user authorization.
State depends on deviceId. Useful when you want to restore user authorization.
case class MyState(deviceId: DeviceId, ...)
StateLoader.forDeviceId { deviceId =>
MyStorage.getStateByDeviceId(deviceId) map {
case Some(state) => state
case None => MyState(deviceId, ...)
}
}