mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
[api-minor] Add a basic AbortSignal.any
polyfill in PDF.js legacy
builds
This is an admittedly very basic polyfill, to allow us to remove a bunch of inline feature testing, that I've thrown together based on reading https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static and related MDN articles. Compared to PR 19218 it's obviously much more "primitive", however the implementation is simple and it doesn't suffer from any licensing issues (since I wrote the code myself).
This commit is contained in:
parent
00e3a4d87a
commit
028e4f7ea8
3 changed files with 42 additions and 30 deletions
27
web/app.js
27
web/app.js
|
@ -559,11 +559,7 @@ const PDFViewerApplication = {
|
|||
}
|
||||
|
||||
if (appConfig.annotationEditorParams) {
|
||||
if (
|
||||
((typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
|
||||
typeof AbortSignal.any === "function") &&
|
||||
annotationEditorMode !== AnnotationEditorType.DISABLE
|
||||
) {
|
||||
if (annotationEditorMode !== AnnotationEditorType.DISABLE) {
|
||||
const editorSignatureButton = appConfig.toolbar?.editorSignatureButton;
|
||||
if (editorSignatureButton && AppOptions.get("enableSignatureEditor")) {
|
||||
editorSignatureButton.parentElement.hidden = false;
|
||||
|
@ -2075,19 +2071,14 @@ const PDFViewerApplication = {
|
|||
_windowAbortController: { signal },
|
||||
} = this;
|
||||
|
||||
if (
|
||||
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
|
||||
typeof AbortSignal.any === "function"
|
||||
) {
|
||||
this._touchManager = new TouchManager({
|
||||
container: window,
|
||||
isPinchingDisabled: () => pdfViewer.isInPresentationMode,
|
||||
isPinchingStopped: () => this.overlayManager?.active,
|
||||
onPinching: this.touchPinchCallback.bind(this),
|
||||
onPinchEnd: this.touchPinchEndCallback.bind(this),
|
||||
signal,
|
||||
});
|
||||
}
|
||||
this._touchManager = new TouchManager({
|
||||
container: window,
|
||||
isPinchingDisabled: () => pdfViewer.isInPresentationMode,
|
||||
isPinchingStopped: () => this.overlayManager?.active,
|
||||
onPinching: this.touchPinchCallback.bind(this),
|
||||
onPinchEnd: this.touchPinchEndCallback.bind(this),
|
||||
signal,
|
||||
});
|
||||
|
||||
function addWindowResolutionChange(evt = null) {
|
||||
if (evt) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue