File

core/common/user-preferences/user-preferences.service.ts

Index

Properties
Methods

Constructor

constructor(user: UserService, inventory: InventoryService, appState: AppStateService)
Parameters :
Name Type Optional
user UserService No
inventory InventoryService No
appState AppStateService No

Methods

get
get(key: string)

Get an Observable value for searched key for current user.

Parameters :
Name Type Optional Description
key string No

The storage key for searched value.

Returns : Observable<any>

An Observable with the value of preference.

getForUser
getForUser(key: string, user: IUser)

Get an Observable value of searched key for a specific user.

Parameters :
Name Type Optional Description
key string No

The storage key for searched value.

user IUser No

The user for whom the search is done.

Returns : Observable<any>

An Observable with the value of preference.

observe
observe(key: string)
Type parameters :
  • T

Returns an observable of a user preference with given key. Emits its initial value first and then updated values when set by user.

Parameters :
Name Type Optional Description
key string No

The storage key for searched value.

Returns : Observable<T>

An Observable of a user preference.

set
set(key: string, value: any)

Sets a value in storage for current user.

Parameters :
Name Type Optional Description
key string No

The storage key for the value to be set.

value any No

The storage value to be set.

Returns : Promise<any>

A promise with saved value.

setForUser
setForUser(key: string, value: any, user: IUser)

Sets a value in storage for a specific user.

Parameters :
Name Type Optional Description
key string No

The storage key for the value to be set.

value any No

The storage value to be set.

user IUser No
Returns : Promise<any>

A promise with saved value.

Properties

currentUser
Type : Observable<IUser>
preferenceChanges$
Type : Subject<UserPreference>
Default value : new Subject()

results matching ""

    No results matching ""