Skip to content

Commit

Permalink
Polyfill Array.prototype.at with core-js (PR 14976 follow-up)
Browse files Browse the repository at this point in the history
This Array-method is a fairly new addition to the ECMAScript specification, hence we need a polyfill to avoid the library/viewer breaking in older browsers.

Please find additional information at:
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at#browser_compatibility
  • Loading branch information
Snuffleupagus committed Jun 8, 2022
1 parent 2fbf14a commit 9e24a16
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/shared/compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ if (
).ReadableStream;
})();

// Support: Firefox<90, Chrome<92, Safari<15.4, Node.js<16.6.0
(function checkArrayAt() {
if (Array.prototype.at) {
return;
}
require("core-js/es/array/at.js");
})();

// Support: Firefox<94, Chrome<98, Safari<15.4, Node.js<17.0.0
(function checkStructuredClone() {
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
Expand Down

0 comments on commit 9e24a16

Please sign in to comment.