Ensure that we return stable observer references
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -27,12 +27,16 @@ import Observable from 'zen-observable';
|
||||
* @public
|
||||
*/
|
||||
export class LocalStoredShortcuts implements ShortcutApi {
|
||||
constructor(private readonly storageApi: StorageApi) {}
|
||||
private readonly shortcuts: Observable<Shortcut[]>;
|
||||
|
||||
constructor(private readonly storageApi: StorageApi) {
|
||||
this.shortcuts = Observable.from(
|
||||
this.storageApi.observe$<Shortcut[]>('items'),
|
||||
).map(snapshot => snapshot.value ?? []);
|
||||
}
|
||||
|
||||
shortcut$() {
|
||||
return Observable.from(this.storageApi.observe$<Shortcut[]>('items')).map(
|
||||
snapshot => snapshot.value ?? [],
|
||||
);
|
||||
return this.shortcuts;
|
||||
}
|
||||
|
||||
get() {
|
||||
|
||||
Reference in New Issue
Block a user