1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Simplify initialization of static class properties in the worker-thread

Now that we no longer depend on the old Babel version in SystemJS we can remove the `static get ...` work-arounds used to define constants, which leads to slightly more compact code.
This commit is contained in:
Jonas Jenwald 2023-03-15 12:20:41 +01:00
parent d950b91c4e
commit b0a1af306d
6 changed files with 16 additions and 58 deletions

View file

@ -17,7 +17,6 @@ import {
assert,
FormatError,
info,
shadow,
unreachable,
Util,
warn,
@ -89,9 +88,7 @@ class Pattern {
class BaseShading {
// A small number to offset the first/last color stops so we can insert ones
// to support extend. Number.MIN_VALUE is too small and breaks the extend.
static get SMALL_NUMBER() {
return shadow(this, "SMALL_NUMBER", 1e-6);
}
static SMALL_NUMBER = 1e-6;
constructor() {
if (this.constructor === BaseShading) {
@ -374,18 +371,12 @@ const getB = (function getBClosure() {
})();
class MeshShading extends BaseShading {
static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
return shadow(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
}
static MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
return shadow(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
}
static MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
// Count of triangles per entire mesh bounds.
static get TRIANGLE_DENSITY() {
return shadow(this, "TRIANGLE_DENSITY", 20);
}
static TRIANGLE_DENSITY = 20;
constructor(
stream,