@churchapps/apphelper
Version:
Library of helper functions for React and NextJS ChurchApps
56 lines • 1.52 kB
TypeScript
import { UserContextInterface } from "@churchapps/helpers";
export interface NotificationCounts {
notificationCount: number;
pmCount: number;
}
export declare class NotificationService {
private static instance;
private counts;
private listeners;
private isInitialized;
private currentPersonId;
private loadTimeout;
private constructor();
static getInstance(): NotificationService;
/**
* Initialize the notification service with user context
*/
initialize(context: UserContextInterface): Promise<void>;
/**
* Register websocket handlers for real-time notification updates
*/
private registerWebSocketHandlers;
/**
* Load notification counts from the API with debouncing
*/
private debouncedLoadNotificationCounts;
/**
* Load notification counts from the API
*/
loadNotificationCounts(): Promise<void>;
/**
* Update counts and notify all listeners
*/
private updateCounts;
/**
* Subscribe to notification count changes
*/
subscribe(listener: (counts: NotificationCounts) => void): () => void;
/**
* Get current notification counts
*/
getCounts(): NotificationCounts;
/**
* Manually refresh notification counts
*/
refresh(): Promise<void>;
/**
* Cleanup the service
*/
cleanup(): void;
/**
* Check if service is initialized
*/
isReady(): boolean;
}
//# sourceMappingURL=NotificationService.d.ts.map