MCPcopy
hub / github.com/parallax/jsPDF / add

Function add

examples/PDF.js/web/debugger.js:475–502  ·  view source on GitHub ↗
(pageNumber, stat)

Source from the content-addressed store, hash-verified

473 active: false,
474 // Stats specific functions.
475 add(pageNumber, stat) {
476 if (!stat) {
477 return;
478 }
479 var statsIndex = getStatIndex(pageNumber);
480 if (statsIndex !== false) {
481 var b = stats[statsIndex];
482 this.panel.removeChild(b.div);
483 stats.splice(statsIndex, 1);
484 }
485 var wrapper = document.createElement("div");
486 wrapper.className = "stats";
487 var title = document.createElement("div");
488 title.className = "title";
489 title.textContent = "Page: " + pageNumber;
490 var statsDiv = document.createElement("div");
491 statsDiv.textContent = stat.toString();
492 wrapper.appendChild(title);
493 wrapper.appendChild(statsDiv);
494 stats.push({ pageNumber, div: wrapper });
495 stats.sort(function(a, b) {
496 return a.pageNumber - b.pageNumber;
497 });
498 clear(this.panel);
499 for (var i = 0, ii = stats.length; i < ii; ++i) {
500 this.panel.appendChild(stats[i].div);
501 }
502 },
503 cleanup() {
504 stats = [];
505 clear(this.panel);

Callers

nothing calls this directly

Calls 3

getStatIndexFunction · 0.85
toStringMethod · 0.80
clearFunction · 0.70

Tested by

no test coverage detected