diff --git a/src/bls12381.js b/src/bls12381.js index 7aa51ac..ce012b8 100644 --- a/src/bls12381.js +++ b/src/bls12381.js @@ -6,6 +6,7 @@ import { ModuleBuilder } from "wasmbuilder"; globalThis.curve_bls12381 = null; export default async function buildBls12381(singleThread, plugins) { + if ((!singleThread) && (globalThis.curve_bls12381)) return globalThis.curve_bls12381; const moduleBuilder = new ModuleBuilder(); moduleBuilder.setMemory(25); @@ -33,7 +34,6 @@ export default async function buildBls12381(singleThread, plugins) { bls12381wasm.r = moduleBuilder.modules.bls12381.r; - if ((!singleThread) && (globalThis.curve_bls12381)) return globalThis.curve_bls12381; const params = { name: "bls12381", wasm: bls12381wasm, diff --git a/src/bn128.js b/src/bn128.js index 8462348..7a421c1 100644 --- a/src/bn128.js +++ b/src/bn128.js @@ -6,6 +6,7 @@ import { ModuleBuilder } from "wasmbuilder"; globalThis.curve_bn128 = null; export default async function buildBn128(singleThread, plugins) { + if ((!singleThread) && (globalThis.curve_bn128)) return globalThis.curve_bn128; const moduleBuilder = new ModuleBuilder(); moduleBuilder.setMemory(25); @@ -32,7 +33,6 @@ export default async function buildBn128(singleThread, plugins) { bn128wasm.q = moduleBuilder.modules.bn128.q; bn128wasm.r = moduleBuilder.modules.bn128.r; - if ((!singleThread) && (globalThis.curve_bn128)) return globalThis.curve_bn128; const params = { name: "bn128", wasm: bn128wasm,