Skip to content

Commit

Permalink
[#58] rename use-events plugin to api
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreezag committed Feb 11, 2024
1 parent 556da0d commit 11993e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useEventStore } from "~/stores/events";
import { useLockedIdsStore } from "~/stores/locked-ids";


export type TUseEventsPluginData = {
export type TUseEventsApi = {
items: Ref<ServerEvent<unknown>[]>;
getItem: (id: EventId) => Promise<ServerEvent<unknown> | null>
getUrl: (id: EventId) => string
Expand All @@ -17,7 +17,7 @@ export type TUseEventsPluginData = {
removeById: (id: EventId) => void
}

export const useEventsPlugin = (): TUseEventsPluginData => {
export const useEventsApi = (): TUseEventsApi => {
const eventsStore = useEventStore();
const cachedIdsStore = useCachedIdsStore();
const lockedIdsStore = useLockedIdsStore();
Expand Down
6 changes: 3 additions & 3 deletions src/shared/lib/use-events/use-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import type { RayContentLock } from "~/src/entities/ray/types";
import type { ServerEvent, NormalizedEvent, EventId } from '../../types';
import { useApiTransport } from "../use-api-transport";
import { normalizeUnknownEvent } from "./normalize-unknown-event";
import { useEventsPlugin, type TUseEventsPluginData } from "./use-events-plugin";
import { type TUseEventsApi, useEventsApi } from "./use-events-api";
import type { TCachedEventsEmptyMap, TEventsGroup } from "~/stores/cached-ids";
import { useCachedIdsStore } from "~/stores/cached-ids";
import { useLockedIdsStore } from "~/stores/locked-ids";


type TUseEvents = () => {
normalizeUnknownEvent: (event: ServerEvent<unknown>) => NormalizedEvent<unknown>
events: TUseEventsPluginData
events: TUseEventsApi
cachedEvents: {
idsByType: Ref<TCachedEventsEmptyMap>;
stopUpdatesByType: (type: TEventsGroup) => void
Expand Down Expand Up @@ -48,7 +48,7 @@ export const useEvents: TUseEvents = () => {

return {
normalizeUnknownEvent,
events: useEventsPlugin(),
events: useEventsApi(),
cachedEvents: {
idsByType: cachedIds as unknown as Ref<TCachedEventsEmptyMap>,
stopUpdatesByType: cachedIdsStore.setByType,
Expand Down

0 comments on commit 11993e8

Please sign in to comment.