1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-28 23:28:16 +02:00

Combine the main-thread message handlers for CMap-, StandardFontData-, and Wasm-files

Currently we have three separate and virtually identical message handlers for this data, which can easily be combined into a single message handler instead.
This commit is contained in:
Jonas Jenwald 2025-02-07 14:28:51 +01:00
parent 651d712109
commit 88e5da1e37
3 changed files with 20 additions and 43 deletions

View file

@ -49,9 +49,10 @@ class JpxImage {
if (this.#wasmUrl !== null) {
this.#buffer = await fetchBinaryData(`${this.#wasmUrl}${filename}`);
} else {
this.#buffer = await this.#handler.sendWithPromise("FetchWasm", {
filename,
});
this.#buffer = await this.#handler.sendWithPromise(
"FetchBinaryData",
{ type: "wasmFactory", filename }
);
}
}
const results = await WebAssembly.instantiate(this.#buffer, imports);