Rename observe() to shortcut
Signed-off-by: Marcus Eide <eide@spotify.com>
This commit is contained in:
@@ -25,7 +25,7 @@ import { shortcutsApiRef } from './api';
|
||||
export const Shortcuts = () => {
|
||||
const shortcutApi = useApi(shortcutsApiRef);
|
||||
const shortcuts = useObservable(
|
||||
useMemo(() => shortcutApi.observe(), [shortcutApi]),
|
||||
useMemo(() => shortcutApi.shortcut$(), [shortcutApi]),
|
||||
);
|
||||
const [anchorEl, setAnchorEl] = React.useState<Element | undefined>();
|
||||
const loading = Boolean(!shortcuts);
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('LocalStoredShortcuts', () => {
|
||||
const shortcut: Shortcut = { id: 'id', title: 'title', url: '/url' };
|
||||
|
||||
await shortcutApi.add(shortcut);
|
||||
shortcutApi.observe().subscribe(data => {
|
||||
shortcutApi.shortcut$().subscribe(data => {
|
||||
expect(data).toEqual(
|
||||
expect.arrayContaining([{ ...shortcut, id: expect.anything() }]),
|
||||
);
|
||||
|
||||
@@ -27,7 +27,7 @@ import { Shortcut } from '../types';
|
||||
export class LocalStoredShortcuts implements ShortcutApi {
|
||||
constructor(private readonly storageApi: StorageApi) {}
|
||||
|
||||
observe() {
|
||||
shortcut$() {
|
||||
return this.observable;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export interface ShortcutApi {
|
||||
/**
|
||||
* Returns an Observable that will subscribe to changes.
|
||||
*/
|
||||
observe(): Observable<Shortcut[]>;
|
||||
shortcut$(): Observable<Shortcut[]>;
|
||||
|
||||
/**
|
||||
* Generates a unique id for the shortcut and then saves it.
|
||||
|
||||
Reference in New Issue
Block a user