UNPKG

@grapecity/gcpdfviewer

Version:
62 lines (61 loc) 2.88 kB
/** @hidden */ /** */ import { PluginModel, DocumentMoniker } from '../api'; import { DocumentViewer } from "../components"; import { SearchResult } from '../features/search'; import { CancellationToken } from './CancellationToken'; export declare type LoadResult = { status: 'loaded'; document: PluginModel.IDocument; } | { status: 'error'; message: string; details?: string; } | { status: 'cancelled'; }; export declare class SessionState { readonly onChangeDocumentView: (view: PluginModel.IDocumentView | null) => void; readonly onChangeDocument: (view: PluginModel.IDocument | null) => void; readonly onDocumentProgress: (view: PluginModel.ProgressMessage) => void; readonly errorSink: PluginModel.IReportError; constructor(onChangeDocumentView: (view: PluginModel.IDocumentView | null) => void, onChangeDocument: (view: PluginModel.IDocument | null) => void, onDocumentProgress: (view: PluginModel.ProgressMessage) => void, errorSink: PluginModel.IReportError); private _plugin; private _document; private _documentView; private _viewState; private _cancel; private setDocumentView; get isDocumentOpened(): boolean; get isRunning(): boolean; get store(): PluginModel.IStore<DocumentViewer.DocViewModel, DocumentViewer.DocViewMsg>; get document(): PluginModel.IDocument | null; get documentView(): PluginModel.IDocumentView | null; setPlugin(plugin: PluginModel.IPluginModule<PluginModel.ViewerEvent, any>): void; gotoPage: (pageIndex: number, doScroll?: boolean, scrollTo?: string | undefined) => Promise<void>; highlight: (result: SearchResult) => Promise<void>; cancel: (reason: any) => Promise<void>; refresh: () => void; updateView: () => void; run: (gotoPageIndex?: number) => Promise<void>; /** Loads the document. Allows to cancel loading. */ load: (doc: DocumentMoniker, token?: CancellationToken | undefined) => Promise<LoadResult>; updateUi: (msg: DocumentViewer.DocViewMsg) => void; private cancellableRun; private processRun; /** run and update session implementation * @param cancel cancellation token * @param gotoPageIndex current page index to stay on after the update * If true, all document properties and pages buffer will be reset. * If false, the document, all its properties will be save, * but all pages in pages buffer will be marked as invalid and then updated (to avoid page blinking during refresh) * @param createView function to run or update document view */ private runImpl; private _lastFetchPagesCall; private _lastPageRequestIndex; private _loadedPageCount; fetchPages: ({ startPage, pageCount }: { startPage: number; pageCount: number; }) => Promise<void>; }