mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
Allow common get and set operations from state providers (#7824)
* Allow common get and set operations from state providers * Use finnish endings for observables
This commit is contained in:
@@ -17,6 +17,23 @@ import { ActiveUserStateProvider, SingleUserStateProvider } from "./user-state.p
|
||||
* and {@link GlobalStateProvider}.
|
||||
*/
|
||||
export abstract class StateProvider {
|
||||
/** @see{@link ActiveUserState.activeUserId$} */
|
||||
activeUserId$: Observable<UserId | undefined>;
|
||||
/**
|
||||
* Gets a state observable for a given key and userId.
|
||||
*
|
||||
* @param keyDefinition - The key definition for the state you want to get.
|
||||
* @param userId - The userId for which you want the state for. If not provided, the state for the currently active user will be returned.
|
||||
*/
|
||||
getUserState$: <T>(keyDefinition: KeyDefinition<T>, userId?: UserId) => Observable<T>;
|
||||
/**
|
||||
* Sets the state for a given key and userId.
|
||||
*
|
||||
* @param keyDefinition - The key definition for the state you want to set.
|
||||
* @param value - The value to set the state to.
|
||||
* @param userId - The userId for which you want to set the state for. If not provided, the state for the currently active user will be set.
|
||||
*/
|
||||
setUserState: <T>(keyDefinition: KeyDefinition<T>, value: T, userId?: UserId) => Promise<void>;
|
||||
/** @see{@link ActiveUserStateProvider.get} */
|
||||
getActive: <T>(keyDefinition: KeyDefinition<T>) => ActiveUserState<T>;
|
||||
/** @see{@link SingleUserStateProvider.get} */
|
||||
|
||||
Reference in New Issue
Block a user