1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #15943 from Snuffleupagus/deprecate-direct-PDFDataRangeTransport

[api-minor] Deprecate calling `getDocument` directly with a `PDFDataRangeTransport`-instance
This commit is contained in:
Tim van der Meij 2023-01-21 13:50:20 +01:00 committed by GitHub
commit a27d7ba524
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -233,8 +233,7 @@ if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")) {
*/
/**
* @typedef { string | URL | TypedArray | ArrayBuffer |
* PDFDataRangeTransport | DocumentInitParameters
* @typedef { string | URL | TypedArray | ArrayBuffer | DocumentInitParameters
* } GetDocumentParameters
*/
@ -258,7 +257,14 @@ function getDocument(src) {
source = { url: src };
} else if (isArrayBuffer(src)) {
source = { data: src };
} else if (src instanceof PDFDataRangeTransport) {
} else if (
(typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
src instanceof PDFDataRangeTransport
) {
deprecated(
"`PDFDataRangeTransport`-instance, " +
"please use a parameter object with `range`-property instead."
);
source = { range: src };
} else {
if (typeof src !== "object") {