Rename observe() to shortcut

Signed-off-by: Marcus Eide <eide@spotify.com>
This commit is contained in:
Marcus Eide
2021-04-21 10:21:33 +02:00
parent e05f09698c
commit 325d8da164
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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.