mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-08 16:15:49 +02:00
Merge pull request #20692 from Snuffleupagus/debugger-findIndex
Replace the `getStatIndex` helper, in `web/debugger.mjs`, with native functionality
This commit is contained in:
commit
f395042b8d
@ -677,14 +677,6 @@ const Stats = (function Stats() {
|
|||||||
function clear(node) {
|
function clear(node) {
|
||||||
node.textContent = ""; // Remove any `node` contents from the DOM.
|
node.textContent = ""; // Remove any `node` contents from the DOM.
|
||||||
}
|
}
|
||||||
function getStatIndex(pageNumber) {
|
|
||||||
for (const [i, stat] of stats.entries()) {
|
|
||||||
if (stat.pageNumber === pageNumber) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
// Properties/functions needed by PDFBug.
|
// Properties/functions needed by PDFBug.
|
||||||
id: "Stats",
|
id: "Stats",
|
||||||
@ -699,8 +691,8 @@ const Stats = (function Stats() {
|
|||||||
if (!stat) {
|
if (!stat) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const statsIndex = getStatIndex(pageNumber);
|
const statsIndex = stats.findIndex(s => s.pageNumber === pageNumber);
|
||||||
if (statsIndex !== false) {
|
if (statsIndex !== -1) {
|
||||||
stats[statsIndex].div.remove();
|
stats[statsIndex].div.remove();
|
||||||
stats.splice(statsIndex, 1);
|
stats.splice(statsIndex, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user