From d1f9f4ed8d1238d3d82af3f225aa1e918944b568 Mon Sep 17 00:00:00 2001 From: Kyle Hensel Date: Thu, 14 Nov 2024 02:29:09 +1300 Subject: [PATCH] Remove polyfill for `global.window` which is now redundant --- CHANGELOG.md | 2 ++ src/index.ts | 1 - src/polyfill.ts | 10 ---------- 3 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 src/polyfill.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 8006aa0..169e73e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Remove polyfill for `global.window` which is now redundant + ## 4.2.0 (2024-11-02) - Add a new option called `renderParams`. This allows you to generate transparent images using `renderParams: { background: 'transparent' }` ([#244]) diff --git a/src/index.ts b/src/index.ts index 89c634e..9892ebd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,3 @@ -import "./polyfill.js"; // do this before pdfjs import { createRequire } from "node:module"; import path from "node:path"; import * as pdfjs from "pdfjs-dist/legacy/build/pdf.mjs"; diff --git a/src/polyfill.ts b/src/polyfill.ts deleted file mode 100644 index 56f348e..0000000 --- a/src/polyfill.ts +++ /dev/null @@ -1,10 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck - -// @ts-expect-error pdfjs references window.xxx, which fails if the jest testEnvironment is node -global.window ||= global; - -// 20ms because that's what pdfjs used to do: https://github.com/mozilla/pdf.js/pull/9138/files -global.window.requestAnimationFrame = (callback) => - global.window.setTimeout(callback, 20); -global.window.cancelAnimationFrame = (id) => global.window.clearTimeout(id);