-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[api-major] Move the remaining options from, and completely remove, the global PDFJS
object
#9493
[api-major] Move the remaining options from, and completely remove, the global PDFJS
object
#9493
Commits on Mar 1, 2018
-
Move API specific compatibility options from `src/shared/compatibilit…
…y.js` and into a separate file Unfortunately, as far as I can tell, we still need the ability to adjust certain API options depending on the browser environment in PDF.js version `2.0`. However, we should be able to separate this from the general compatibility code in the `src/shared/compatibility.js` file.
Configuration menu - View commit details
-
Copy full SHA for 5894bfa - Browse repository at this point
Copy the full SHA 5894bfaView commit details -
Introduce a
AppOptions
abstraction in preparation for a complete re……factoring of the way that viewer options are handled The way that various options are handled in the default viewer is currently a bit of a mess (to say the least). Some viewer options reside in the global `PDFJS` object, while others reside in `Preferences`. To make matters worse, some options even exist in both of the two. Since the goal, with PDF.js version `2.0`, is to reduce our usage of the global `PDFJS` object, we'll instead want pass in the options when initializing the viewer components and when calling API methods (such as `getDocument`). However given the current state of things in the default viewer, this wouldn't be exactly easy to implement. Hence this patch, which attempts to consolidate the way that viewer (and later API) options are handled by introducing a `AppOptions` singleton that provides *one* centralized way of interacting with the various options in the default viewer.
Configuration menu - View commit details
-
Copy full SHA for 09da99b - Browse repository at this point
Copy the full SHA 09da99bView commit details -
Move various viewer components options from
PDFJS
/`PDFViewerApplica……tion.viewerPrefs` and into `AppOptions` instead
Configuration menu - View commit details
-
Copy full SHA for 81c5509 - Browse repository at this point
Copy the full SHA 81c5509View commit details -
Move the
defaultUrl
parameter from theappConfig
and into `AppOpt……ions` instead The `appConfig` contains (mostly) references to various DOM elements, used when initializing the viewer components. Hence `defaultUrl` seem like a slightly better fit for the new `AppOptions` abstraction, not to mention that it should thus be easier to set/modify it for custom deployments of the default viewer.
Configuration menu - View commit details
-
Copy full SHA for 57165af - Browse repository at this point
Copy the full SHA 57165afView commit details -
Refactor how the default viewer handles the worker options, by making…
… use of `AppOptions` instead of the global `PDFJS` object
Configuration menu - View commit details
-
Copy full SHA for b0956a5 - Browse repository at this point
Copy the full SHA b0956a5View commit details -
Move the
maxImageSize
option from the globalPDFJS
object and int……o `getDocument` instead
Configuration menu - View commit details
-
Copy full SHA for b674409 - Browse repository at this point
Copy the full SHA b674409View commit details -
Move the
cMapUrl
andcMapPacked
options from the globalPDFJS
o……bject and into `getDocument` instead
Configuration menu - View commit details
-
Copy full SHA for 3c2fbdf - Browse repository at this point
Copy the full SHA 3c2fbdfView commit details -
Move the
isEvalSupported
option from the globalPDFJS
object and ……into `getDocument` instead
Configuration menu - View commit details
-
Copy full SHA for f3900c4 - Browse repository at this point
Copy the full SHA f3900c4View commit details -
Move the
disableFontFace
option from the globalPDFJS
object and ……into `getDocument` instead
Configuration menu - View commit details
-
Copy full SHA for c7c5835 - Browse repository at this point
Copy the full SHA c7c5835View commit details -
Move the
disableAutoFetch
option from the globalPDFJS
object and…… into `getDocument` instead One additional complication with removing this option from the global `PDFJS` object, is that the viewer currently needs to check `disableAutoFetch` in a couple of places. To address this I'm thus proposing adding a getter in `PDFDocumentProxy`, to allow checking the *actually* used values for a particular `getDocument` invocation.
Configuration menu - View commit details
-
Copy full SHA for 69d7191 - Browse repository at this point
Copy the full SHA 69d7191View commit details -
Move the
disableRange
option from the globalPDFJS
object and int……o `getDocument` instead
Configuration menu - View commit details
-
Copy full SHA for b69abf1 - Browse repository at this point
Copy the full SHA b69abf1View commit details -
Move the
disableStream
option from the globalPDFJS
object and in……to `getDocument` instead
Configuration menu - View commit details
-
Copy full SHA for 05c05bd - Browse repository at this point
Copy the full SHA 05c05bdView commit details -
Move the
disableCreateObjectURL
option from the globalPDFJS
obje……ct and into `getDocument` instead
Configuration menu - View commit details
-
Copy full SHA for 1d03ad0 - Browse repository at this point
Copy the full SHA 1d03ad0View commit details -
Move the
pdfBug
option from the globalPDFJS
object and into `get……Document` instead Also removes the now unused `getDefaultSetting` helper function.
Configuration menu - View commit details
-
Copy full SHA for 2125538 - Browse repository at this point
Copy the full SHA 2125538View commit details -
Ensure that we only pass in the necessary parameters when initializin…
…g `PDFDataTransportStream`/`PDFNetworkStream` in `src/display/api.js` With options being moved from the global `PDFJS` object and into `getDocument`, a side-effect is that we're now passing in a fair number of useless parameters to the various transport/network streams. Even though this doesn't *currently* cause any problems, it nonetheless seem like a good idea to explicitly provide the parameters that are actually necessary.
Configuration menu - View commit details
-
Copy full SHA for 4b4fcec - Browse repository at this point
Copy the full SHA 4b4fcecView commit details -
Configuration menu - View commit details
-
Copy full SHA for b8606ab - Browse repository at this point
Copy the full SHA b8606abView commit details