MCPcopy
hub / github.com/1j01/jspaint / push

Method push

lib/pdf.js/web/viewer.js:6253–6308  ·  view source on GitHub ↗
({
    namedDest = null,
    explicitDest,
    pageNumber
  })

Source from the content-addressed store, hash-verified

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) {

Callers 15

sync-package.jsFile · 0.80
findDependenciesFunction · 0.80
add_localizationFunction · 0.80
parse-rc-file.jsFile · 0.80
seFunction · 0.80
ueFunction · 0.80
TeFunction · 0.80
CeFunction · 0.80
EeFunction · 0.80
TFunction · 0.80
SFunction · 0.80

Calls 5

_isValidPageMethod · 0.95
_pushOrReplaceStateMethod · 0.95
isDestHashesEqualFunction · 0.85
isDestArraysEqualFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected