Merge pull request #15742 from Snuffleupagus/deprecate-textLayer-timeout

[api-minor] Deprecate the TextLayer `timeout` parameter
This commit is contained in:
Jonas Jenwald 2022-11-25 08:44:02 +01:00 committed by GitHub
commit 67741aeaa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ import {
createPromiseCapability, createPromiseCapability,
Util, Util,
} from "../shared/util.js"; } from "../shared/util.js";
import { deprecated } from "./display_utils.js";
/** /**
* Text layer render parameters. * Text layer render parameters.
@ -250,7 +251,6 @@ class TextLayerRenderTask {
this._canceled = false; this._canceled = false;
this._capability = createPromiseCapability(); this._capability = createPromiseCapability();
this._renderTimer = null; this._renderTimer = null;
this._bounds = [];
this._devicePixelRatio = globalThis.devicePixelRatio || 1; this._devicePixelRatio = globalThis.devicePixelRatio || 1;
// Always clean-up the temporary canvas once rendering is no longer pending. // Always clean-up the temporary canvas once rendering is no longer pending.
@ -421,6 +421,13 @@ class TextLayerRenderTask {
// Render right away // Render right away
render(this); render(this);
} else { } else {
if (typeof PDFJSDev !== "undefined" && !PDFJSDev.test("GENERIC")) {
throw new Error("The `timeout` parameter was removed.");
}
deprecated(
"The TextLayerRender `timeout` parameter will be removed in the " +
"future, since streaming of textContent has made it obsolete."
);
// Schedule // Schedule
this._renderTimer = setTimeout(() => { this._renderTimer = setTimeout(() => {
render(this); render(this);