react-horizontal-scrolling-menu
Version:
Horizontal scrolling menu component for React with per-item visibility tracking. Supports mouse and touch devices, SSR-safe.
13 lines (12 loc) • 516 B
TypeScript
import type { EventKey, IOItem } from '../types';
export type ObsFn = (val?: IOItem) => void;
export type EventPayload = [key: EventKey, value?: IOItem];
export declare class Observer {
observers: Map<EventKey, ObsFn[]>;
constructor();
subscribe: (key: EventKey, fn: ObsFn) => void;
unsubscribe: (key: EventKey, fn: ObsFn) => void;
private emitUpdates;
updateBatch: (entries: EventPayload[], onUpdate?: boolean) => void;
update: (key: EventPayload[0], value?: EventPayload[1]) => void;
}