@magicbell/react-headless
Version:
Hooks to build a notification inbox
27 lines (26 loc) • 1.21 kB
TypeScript
export declare function getAuthHeaders(): {
'x-magicbell-api-key': string;
'x-magicbell-client-user-agent': string;
};
/** @deprecated */
export declare const pushEventAggregator: import("mittly").Emitter<Record<import("mittly").EventType, unknown>>;
export declare const eventAggregator: import("mittly").Emitter<Record<import("mittly").EventType, unknown>>;
export type EventSource = 'local' | 'remote';
/**
* Publish events to the internal and public event emitter, based on the event source.
*
* @param event The name of the event.
* @param data The data object to pass along with the event.
* @param source The origin of the event, local for an action that's triggered by the user in the current tab, remote if it's an event from another instance that should be mirrored.
*/
export declare function emitEvent(event: string, data: unknown, source: EventSource): void;
/**
* Publish an socket event to the push event emitter. If the push event contains
* the ID of a notification, this is fetched before emitting the event.
*
* @param event The realtime event
*/
export declare function handleSocketEvent(event: {
name: string;
data: Record<string, unknown>;
}): Promise<void>;