1 | export type PDFHistoryOptions = {
|
2 | /**
|
3 | * - The navigation/linking service.
|
4 | */
|
5 | linkService: IPDFLinkService;
|
6 | /**
|
7 | * - The application event bus.
|
8 | */
|
9 | eventBus: EventBus;
|
10 | };
|
11 | export type InitializeParameters = {
|
12 | /**
|
13 | * - The PDF document's unique fingerprint.
|
14 | */
|
15 | fingerprint: string;
|
16 | /**
|
17 | * - Reset the browsing history.
|
18 | */
|
19 | resetHistory?: boolean | undefined;
|
20 | /**
|
21 | * - Attempt to update the document URL, with
|
22 | * the current hash, when pushing/replacing browser history entries.
|
23 | */
|
24 | updateUrl?: boolean | undefined;
|
25 | };
|
26 | export type PushParameters = {
|
27 | /**
|
28 | * - The named destination. If absent, a
|
29 | * stringified version of `explicitDest` is used.
|
30 | */
|
31 | namedDest?: string | undefined;
|
32 | /**
|
33 | * - The explicit destination array.
|
34 | */
|
35 | explicitDest: any[];
|
36 | /**
|
37 | * - The page to which the destination points.
|
38 | */
|
39 | pageNumber: number;
|
40 | };
|
41 | export type EventBus = import("./event_utils").EventBus;
|
42 | export type IPDFLinkService = import("./interfaces").IPDFLinkService;
|
43 | export function isDestArraysEqual(firstDest: any, secondDest: any): boolean;
|
44 | export function isDestHashesEqual(destHash: any, pushHash: any): boolean;
|
45 | export class PDFHistory {
|
46 | /**
|
47 | * @param {PDFHistoryOptions} options
|
48 | */
|
49 | constructor({ linkService, eventBus }: PDFHistoryOptions);
|
50 | linkService: import("./interfaces").IPDFLinkService;
|
51 | eventBus: import("./event_utils.js").EventBus;
|
52 | _initialized: boolean;
|
53 | _fingerprint: string;
|
54 | _boundEvents: {
|
55 | updateViewarea: ({ location }: {
|
56 | location: any;
|
57 | }) => void;
|
58 | popState: ({ state }: {
|
59 | state: any;
|
60 | }) => void;
|
61 | pageHide: () => void;
|
62 | } | null;
|
63 | _isViewerInPresentationMode: boolean;
|
64 | _isPagesLoaded: boolean;
|
65 | /**
|
66 | * Initialize the history for the PDF document, using either the current
|
67 | * browser history entry or the document hash, whichever is present.
|
68 | * @param {InitializeParameters} params
|
69 | */
|
70 | initialize({ fingerprint, resetHistory, updateUrl }: InitializeParameters): void;
|
71 | _updateUrl: boolean | undefined;
|
72 | _popStateInProgress: boolean | undefined;
|
73 | _blockHashChange: number | undefined;
|
74 | _currentHash: string | undefined;
|
75 | _numPositionUpdates: number | undefined;
|
76 | _uid: any;
|
77 | _maxUid: any;
|
78 | _destination: any;
|
79 | _position: {
|
80 | hash: any;
|
81 | page: number;
|
82 | first: any;
|
83 | rotation: any;
|
84 | } | null | undefined;
|
85 | _initialRotation: any;
|
86 | _initialBookmark: any;
|
87 | /**
|
88 | * Reset the current `PDFHistory` instance, and consequently prevent any
|
89 | * further updates and/or navigation of the browser history.
|
90 | */
|
91 | reset(): void;
|
92 | _updateViewareaTimeout: any;
|
93 | /**
|
94 | * Push an internal destination to the browser history.
|
95 | * @param {PushParameters}
|
96 | */
|
97 | push({ namedDest, explicitDest, pageNumber }: PushParameters): void;
|
98 | /**
|
99 | * Push a page to the browser history; generally the `push` method should be
|
100 | * used instead.
|
101 | * @param {number} pageNumber
|
102 | */
|
103 | pushPage(pageNumber: number): void;
|
104 | /**
|
105 | * Push the current position to the browser history.
|
106 | */
|
107 | pushCurrentPosition(): void;
|
108 | /**
|
109 | * Go back one step in the browser history.
|
110 | * NOTE: Avoids navigating away from the document, useful for "named actions".
|
111 | */
|
112 | back(): void;
|
113 | /**
|
114 | * Go forward one step in the browser history.
|
115 | * NOTE: Avoids navigating away from the document, useful for "named actions".
|
116 | */
|
117 | forward(): void;
|
118 | /**
|
119 | * @type {boolean} Indicating if the user is currently moving through the
|
120 | * browser history, useful e.g. for skipping the next 'hashchange' event.
|
121 | */
|
122 | get popStateInProgress(): boolean;
|
123 | get initialBookmark(): any;
|
124 | get initialRotation(): any;
|
125 | /**
|
126 | * @private
|
127 | */
|
128 | private _pushOrReplaceState;
|
129 | /**
|
130 | * @private
|
131 | */
|
132 | private _tryPushCurrentPosition;
|
133 | /**
|
134 | * @private
|
135 | */
|
136 | private _isValidPage;
|
137 | /**
|
138 | * @private
|
139 | */
|
140 | private _isValidState;
|
141 | /**
|
142 | * @private
|
143 | */
|
144 | private _updateInternalState;
|
145 | /**
|
146 | * @private
|
147 | */
|
148 | private _parseCurrentHash;
|
149 | /**
|
150 | * @private
|
151 | */
|
152 | private _updateViewarea;
|
153 | /**
|
154 | * @private
|
155 | */
|
156 | private _popState;
|
157 | /**
|
158 | * @private
|
159 | */
|
160 | private _pageHide;
|
161 | /**
|
162 | * @private
|
163 | */
|
164 | private _bindEvents;
|
165 | /**
|
166 | * @private
|
167 | */
|
168 | private _unbindEvents;
|
169 | }
|