parent
45a32b7c58
commit
0c14d6e2db
@ -29,8 +29,6 @@ class JpxImage {
|
|||||||
|
|
||||||
static #handler = null;
|
static #handler = null;
|
||||||
|
|
||||||
static #instantiationFailed = false;
|
|
||||||
|
|
||||||
static #modulePromise = null;
|
static #modulePromise = null;
|
||||||
|
|
||||||
static #wasmUrl = null;
|
static #wasmUrl = null;
|
||||||
@ -58,10 +56,6 @@ class JpxImage {
|
|||||||
}
|
}
|
||||||
const results = await WebAssembly.instantiate(this.#buffer, imports);
|
const results = await WebAssembly.instantiate(this.#buffer, imports);
|
||||||
return successCallback(results.instance);
|
return successCallback(results.instance);
|
||||||
} catch (e) {
|
|
||||||
this.#instantiationFailed = true;
|
|
||||||
warn(`Cannot load ${filename}: "${e}".`);
|
|
||||||
return false;
|
|
||||||
} finally {
|
} finally {
|
||||||
this.#handler = null;
|
this.#handler = null;
|
||||||
this.#wasmUrl = null;
|
this.#wasmUrl = null;
|
||||||
@ -72,10 +66,6 @@ class JpxImage {
|
|||||||
bytes,
|
bytes,
|
||||||
{ numComponents = 4, isIndexedColormap = false, smaskInData = false } = {}
|
{ numComponents = 4, isIndexedColormap = false, smaskInData = false } = {}
|
||||||
) {
|
) {
|
||||||
if (this.#instantiationFailed) {
|
|
||||||
throw new JpxError("OpenJPEG failed to instantiate.");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.#modulePromise ||= OpenJPEG({
|
this.#modulePromise ||= OpenJPEG({
|
||||||
warn,
|
warn,
|
||||||
instantiateWasm: this.#instantiateWasm.bind(this),
|
instantiateWasm: this.#instantiateWasm.bind(this),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user