mirror of
https://github.com/tornadocash/websnark.git
synced 2025-01-15 23:47:47 +01:00
Fix borwser env for tornado snarkjs
This commit is contained in:
parent
fe9f4119c4
commit
a0a680ea80
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -22,9 +22,15 @@ const bigInt = require("big-integer");
|
|||||||
const groth16_wasm = require("../build/groth16_wasm.js");
|
const groth16_wasm = require("../build/groth16_wasm.js");
|
||||||
const assert = require("assert");
|
const assert = require("assert");
|
||||||
|
|
||||||
const inBrowser = (typeof window !== "undefined");
|
const inBrowser = (typeof window !== "undefined") || process && process.env && process.env.FOR_BROWSER === "true";
|
||||||
|
|
||||||
|
|
||||||
let NodeWorker;
|
let NodeWorker;
|
||||||
let NodeCrypto;
|
let NodeCrypto;
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(`Running in browser ${inBrowser}`);
|
||||||
|
|
||||||
if (!inBrowser) {
|
if (!inBrowser) {
|
||||||
NodeWorker = require("worker_threads").Worker;
|
NodeWorker = require("worker_threads").Worker;
|
||||||
NodeCrypto = require("crypto");
|
NodeCrypto = require("crypto");
|
||||||
|
Loading…
Reference in New Issue
Block a user