mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Replace a bunch of Array.prototype.forEach()
cases with for...of
loops instead
Using `for...of` is a modern and generally much nicer pattern, since it gets rid of unnecessary callback-functions. (In a couple of spots, a "regular" `for` loop had to be used.)
This commit is contained in:
parent
da0e7ea969
commit
da22146b95
14 changed files with 67 additions and 71 deletions
|
@ -2289,11 +2289,11 @@ class WorkerTransport {
|
|||
const waitOn = [];
|
||||
// We need to wait for all renderings to be completed, e.g.
|
||||
// timeout/rAF can take a long time.
|
||||
this.pageCache.forEach(function (page) {
|
||||
for (const page of this.pageCache) {
|
||||
if (page) {
|
||||
waitOn.push(page._destroy());
|
||||
}
|
||||
});
|
||||
}
|
||||
this.pageCache.length = 0;
|
||||
this.pagePromises.length = 0;
|
||||
// Allow `AnnotationStorage`-related clean-up when destroying the document.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue