Re-factor setPDFNetworkStreamFactory, in src/display/api.js, to also accept an asynchronous function

As part of trying to reduce the usage of SystemJS in the development viewer, this patch is a necessary step that will allow removal of some `require` statements.

Currently this uses `SystemJS.import` in non-PRODUCTION mode, but it should be possible to replace those with standard *dynamic* `import` calls in the future.
This commit is contained in:
Jonas Jenwald 2020-05-19 15:10:05 +02:00
parent 0960e6c0b5
commit d4d933538b
4 changed files with 72 additions and 32 deletions

View file

@ -26,6 +26,12 @@ import {
validateResponseStatus,
} from "./network_utils.js";
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
throw new Error(
'Module "./fetch_stream.js" shall not be used with MOZCENTRAL builds.'
);
}
function createFetchOptions(headers, withCredentials, abortController) {
return {
method: "GET",