MCPcopy
hub / github.com/TriliumNext/Trilium / push

Method push

packages/pdfjs-viewer/viewer/viewer.mjs:7573–7619  ·  view source on GitHub ↗
({
    namedDest = null,
    explicitDest,
    pageNumber
  })

Source from the content-addressed store, hash-verified

7571 this._initialRotation = null;
7572 }
7573 push({
7574 namedDest = null,
7575 explicitDest,
7576 pageNumber
7577 }) {
7578 if (!this._initialized) {
7579 return;
7580 }
7581 if (namedDest && typeof namedDest !== "string") {
7582 console.error("PDFHistory.push: " + `"${namedDest}" is not a valid namedDest parameter.`);
7583 return;
7584 } else if (!Array.isArray(explicitDest)) {
7585 console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`);
7586 return;
7587 } else if (!this.#isValidPage(pageNumber)) {
7588 if (pageNumber !== null || this._destination) {
7589 console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`);
7590 return;
7591 }
7592 }
7593 const hash = namedDest || JSON.stringify(explicitDest);
7594 if (!hash) {
7595 return;
7596 }
7597 let forceReplace = false;
7598 if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) {
7599 if (this._destination.page) {
7600 return;
7601 }
7602 forceReplace = true;
7603 }
7604 if (this._popStateInProgress && !forceReplace) {
7605 return;
7606 }
7607 this.#pushOrReplaceState({
7608 dest: explicitDest,
7609 hash,
7610 page: pageNumber,
7611 rotation: this.linkService.rotation
7612 }, forceReplace);
7613 if (!this._popStateInProgress) {
7614 this._popStateInProgress = true;
7615 Promise.resolve().then(() => {
7616 this._popStateInProgress = false;
7617 });
7618 }
7619 }
7620 pushPage(pageNumber) {
7621 if (!this._initialized) {
7622 return;

Callers 15

modelQueryElementsAllFunction · 0.45
modelQueryTextAllFunction · 0.45
_removeReferencesMethod · 0.45
_applyQuoteMethod · 0.45
getRangesOfBlockGroupsFunction · 0.45
getVisibleElementsFunction · 0.45
goToDestinationMethod · 0.45
dispatchMethod · 0.45
_onMethod · 0.45
getArgumentsFunction · 0.45
resolveComplexPatternFunction · 0.45
reportErrorMethod · 0.45

Calls 5

#isValidPageMethod · 0.95
#pushOrReplaceStateMethod · 0.95
isDestHashesEqualFunction · 0.85
isDestArraysEqualFunction · 0.85
errorMethod · 0.80

Tested by 4

getNoteIdsFunction · 0.36
traverseItemsFunction · 0.36
buildConfigFunction · 0.36
mockCallbackFunction · 0.36