UNPKG

@vue-pdf-viewer/viewer

Version:

A vue-pdf-viewer component for Vue and Nuxt. Suitable for vue-pdf document.

50 lines (49 loc) 1.65 kB
import { AnnotationType } from '@vue-pdf-viewer/shared'; import { AnnotationHighlight, AnnotationStamp, AnnotationFreeText } from '@/utils/types'; /** * Unified annotation type that can represent any annotation */ export type UnifiedAnnotation = AnnotationHighlight | AnnotationStamp | AnnotationFreeText; /** * Annotation event types for the unified event system */ export type AnnotationEventType = 'add' | 'update' | 'remove'; /** * Annotation event payload */ export interface AnnotationEvent<T extends UnifiedAnnotation = UnifiedAnnotation> { type: AnnotationEventType; annotationType: AnnotationType; annotation: T; pageIndex: number; } /** * Annotation event listener type */ export type AnnotationEventListener<T extends UnifiedAnnotation = UnifiedAnnotation> = (event: AnnotationEvent<T>) => void; /** * Global event emitter for all annotation types * This provides a unified way to handle annotation updates across the application */ declare class AnnotationEventEmitter { private listeners; private globalListeners; /** * Emit an annotation event */ emit<T extends UnifiedAnnotation>(event: AnnotationEvent<T>): void; /** * Subscribe to events for a specific annotation type */ subscribe<T extends UnifiedAnnotation>(annotationType: AnnotationType, listener: AnnotationEventListener<T>): () => void; /** * Subscribe to all annotation events */ subscribeAll(listener: AnnotationEventListener): () => void; /** * Clear all listeners */ clear(): void; } export declare const annotationEventEmitter: AnnotationEventEmitter; export {};