({
namedDest = null,
explicitDest,
pageNumber
})
| 5508 | this._initialRotation = null; |
| 5509 | } |
| 5510 | push({ |
| 5511 | namedDest = null, |
| 5512 | explicitDest, |
| 5513 | pageNumber |
| 5514 | }) { |
| 5515 | if (!this._initialized) { |
| 5516 | return; |
| 5517 | } |
| 5518 | if (namedDest && typeof namedDest !== "string") { |
| 5519 | console.error("PDFHistory.push: " + `"${namedDest}" is not a valid namedDest parameter.`); |
| 5520 | return; |
| 5521 | } else if (!Array.isArray(explicitDest)) { |
| 5522 | console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`); |
| 5523 | return; |
| 5524 | } else if (!this.#isValidPage(pageNumber)) { |
| 5525 | if (pageNumber !== null || this._destination) { |
| 5526 | console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`); |
| 5527 | return; |
| 5528 | } |
| 5529 | } |
| 5530 | const hash = namedDest || JSON.stringify(explicitDest); |
| 5531 | if (!hash) { |
| 5532 | return; |
| 5533 | } |
| 5534 | let forceReplace = false; |
| 5535 | if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) { |
| 5536 | if (this._destination.page) { |
| 5537 | return; |
| 5538 | } |
| 5539 | forceReplace = true; |
| 5540 | } |
| 5541 | if (this._popStateInProgress && !forceReplace) { |
| 5542 | return; |
| 5543 | } |
| 5544 | this.#pushOrReplaceState({ |
| 5545 | dest: explicitDest, |
| 5546 | hash, |
| 5547 | page: pageNumber, |
| 5548 | rotation: this.linkService.rotation |
| 5549 | }, forceReplace); |
| 5550 | if (!this._popStateInProgress) { |
| 5551 | this._popStateInProgress = true; |
| 5552 | Promise.resolve().then(() => { |
| 5553 | this._popStateInProgress = false; |
| 5554 | }); |
| 5555 | } |
| 5556 | } |
| 5557 | pushPage(pageNumber) { |
| 5558 | if (!this._initialized) { |
| 5559 | return; |
no test coverage detected