-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Move the initialization of "page labels"/"metadata"/"auto print" out of PDFViewerApplication.load
#11780
Move the initialization of "page labels"/"metadata"/"auto print" out of PDFViewerApplication.load
#11780
Conversation
43f0d14
to
3a83399
Compare
PDFViewerApplication.load
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/0f0f646f5fc87fa/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/0f0f646f5fc87fa/output.txt Total script time: 2.39 mins Published |
….load` Over time, with more and more API-functionality added, the `PDFViewerApplication.load` method has become quite large and complex. In an attempt to improve the current situation somewhat, this patch moves the fetching and initialization of "page labels" out into its own (private) helper method instead.
Over time, with more and more API-functionality added, the `PDFViewerApplication.load` method has become quite large and complex. In an attempt to improve the current situation somewhat, this patch moves the fetching and initialization of "metadata" out into its own (private) helper method instead.
…load` Over time, with more and more API-functionality added, the `PDFViewerApplication.load` method has become quite large and complex. In an attempt to improve the current situation somewhat, this patch moves the fetching and initialization of "auto print" out into its own (private) helper method instead.
…izeMetadata, _initializePdfHistory}` methods - Use template strings when printing document/viewer information in `_initializeMetadata`, since the old format feels overly verbose. Also, get the WebGL state from the `BaseViewer` instance[1] rather than the `AppOptions`. Since the `AppOptions` value could theoretically have been changed (by the user) after the viewer components were initialized, it seems much more useful to print the *actual* value that'll be used during rendering. - Change `_initializePdfHistory` to actually do the "is embedded"-check first, in accordance with the comment and given that the "disableHistory" option usually shouldn't be set. --- [1] Admittedly reaching into the `BaseViewer` instance and just grabbing the value perhaps isn't a great approach overall, but given that the WebGL-backend isn't even on by default this probably doesn't matter too much.
3a83399
to
9ef5834
Compare
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/fb4fe836f6a503a/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/fb4fe836f6a503a/output.txt Total script time: 2.47 mins Published |
The method is reduced from 400 lines of code to 200 lines; much better! |
Please refer to the individual commit messages for additional details.
For awhile now I've been thinking that the
PDFViewerApplication.load
method has become way to large and unwieldy, hence this series of patches that move some of its non-critical code out into helper methods instead.Edit: Currently blocked by PR #11781.