mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
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:
parent
0960e6c0b5
commit
d4d933538b
4 changed files with 72 additions and 32 deletions
|
@ -14,11 +14,6 @@
|
|||
*/
|
||||
/* globals __non_webpack_require__ */
|
||||
|
||||
const fs = __non_webpack_require__("fs");
|
||||
const http = __non_webpack_require__("http");
|
||||
const https = __non_webpack_require__("https");
|
||||
const url = __non_webpack_require__("url");
|
||||
|
||||
import {
|
||||
AbortException,
|
||||
assert,
|
||||
|
@ -30,6 +25,17 @@ import {
|
|||
validateRangeRequestCapabilities,
|
||||
} from "./network_utils.js";
|
||||
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
throw new Error(
|
||||
'Module "./node_stream.js" shall not be used with MOZCENTRAL builds.'
|
||||
);
|
||||
}
|
||||
|
||||
const fs = __non_webpack_require__("fs");
|
||||
const http = __non_webpack_require__("http");
|
||||
const https = __non_webpack_require__("https");
|
||||
const url = __non_webpack_require__("url");
|
||||
|
||||
const fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//;
|
||||
|
||||
function parseUrl(sourceUrl) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue