({
namedDest = null,
explicitDest,
pageNumber
})
| 6251 | } |
| 6252 | |
| 6253 | push({ |
| 6254 | namedDest = null, |
| 6255 | explicitDest, |
| 6256 | pageNumber |
| 6257 | }) { |
| 6258 | if (!this._initialized) { |
| 6259 | return; |
| 6260 | } |
| 6261 | |
| 6262 | if (namedDest && typeof namedDest !== "string") { |
| 6263 | console.error("PDFHistory.push: " + `"${namedDest}" is not a valid namedDest parameter.`); |
| 6264 | return; |
| 6265 | } else if (!Array.isArray(explicitDest)) { |
| 6266 | console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`); |
| 6267 | return; |
| 6268 | } else if (!this._isValidPage(pageNumber)) { |
| 6269 | if (pageNumber !== null || this._destination) { |
| 6270 | console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`); |
| 6271 | return; |
| 6272 | } |
| 6273 | } |
| 6274 | |
| 6275 | const hash = namedDest || JSON.stringify(explicitDest); |
| 6276 | |
| 6277 | if (!hash) { |
| 6278 | return; |
| 6279 | } |
| 6280 | |
| 6281 | let forceReplace = false; |
| 6282 | |
| 6283 | if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) { |
| 6284 | if (this._destination.page) { |
| 6285 | return; |
| 6286 | } |
| 6287 | |
| 6288 | forceReplace = true; |
| 6289 | } |
| 6290 | |
| 6291 | if (this._popStateInProgress && !forceReplace) { |
| 6292 | return; |
| 6293 | } |
| 6294 | |
| 6295 | this._pushOrReplaceState({ |
| 6296 | dest: explicitDest, |
| 6297 | hash, |
| 6298 | page: pageNumber, |
| 6299 | rotation: this.linkService.rotation |
| 6300 | }, forceReplace); |
| 6301 | |
| 6302 | if (!this._popStateInProgress) { |
| 6303 | this._popStateInProgress = true; |
| 6304 | Promise.resolve().then(() => { |
| 6305 | this._popStateInProgress = false; |
| 6306 | }); |
| 6307 | } |
| 6308 | } |
| 6309 | |
| 6310 | pushPage(pageNumber) { |
no test coverage detected