mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Add iteration support in the PDFObjects
class
This (obviously) only includes "resolved" data, and will be used in an upcoming patch.
This commit is contained in:
parent
7ea0e40e58
commit
b09f238436
1 changed files with 12 additions and 1 deletions
|
@ -3125,7 +3125,7 @@ class PDFObjects {
|
|||
*/
|
||||
has(objId) {
|
||||
const obj = this.#objs[objId];
|
||||
return obj?.capability.settled || false;
|
||||
return obj?.capability.settled ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3147,6 +3147,17 @@ class PDFObjects {
|
|||
}
|
||||
this.#objs = Object.create(null);
|
||||
}
|
||||
|
||||
*[Symbol.iterator]() {
|
||||
for (const objId in this.#objs) {
|
||||
const { capability, data } = this.#objs[objId];
|
||||
|
||||
if (!capability.settled) {
|
||||
continue;
|
||||
}
|
||||
yield [objId, data];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue