1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Remove the PdfManager.onLoadedStream method (PR 15616 follow-up)

After the clean-up in PR 15616, the `PdfManager.onLoadedStream` method now only has a single call-site.
Hence why this patch suggests that we remove this method and replace it with an *optional* parameter in `PdfManager.requestLoadedStream` instead. By making the new behaviour opt-in, we'll thus not change any existing call-site.
This commit is contained in:
Jonas Jenwald 2022-10-25 15:07:12 +02:00
parent 5b46400240
commit caef47a0cf
3 changed files with 10 additions and 24 deletions

View file

@ -55,10 +55,6 @@ class BasePdfManager {
return shadow(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
}
onLoadedStream() {
unreachable("Abstract method `onLoadedStream` called");
}
ensureDoc(prop, args) {
return this.ensure(this.pdfDocument, prop, args);
}
@ -103,7 +99,7 @@ class BasePdfManager {
unreachable("Abstract method `requestRange` called");
}
requestLoadedStream() {
requestLoadedStream(noFetch = false) {
unreachable("Abstract method `requestLoadedStream` called");
}
@ -156,11 +152,7 @@ class LocalPdfManager extends BasePdfManager {
return Promise.resolve();
}
requestLoadedStream() {
return this._loadedStreamPromise;
}
onLoadedStream() {
requestLoadedStream(noFetch = false) {
return this._loadedStreamPromise;
}
@ -214,18 +206,14 @@ class NetworkPdfManager extends BasePdfManager {
return this.streamManager.requestRange(begin, end);
}
requestLoadedStream() {
return this.streamManager.requestAllChunks();
requestLoadedStream(noFetch = false) {
return this.streamManager.requestAllChunks(noFetch);
}
sendProgressiveData(chunk) {
this.streamManager.onReceiveData({ chunk });
}
onLoadedStream() {
return this.streamManager.onLoadedStream();
}
terminate(reason) {
this.streamManager.abort(reason);
}