Add herumi fallback in default export
This commit is contained in:
parent
a8aa891768
commit
501f93e333
|
@ -1,8 +1,14 @@
|
|||
import type {IBls} from "./interface.js";
|
||||
import {getImplementation} from "./getImplementation.js";
|
||||
|
||||
// Thanks https://github.com/iliakan/detect-node/blob/master/index.esm.js
|
||||
const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
|
||||
|
||||
const bls = await getImplementation(isNode ? "blst-native" : "herumi");
|
||||
let bls: IBls;
|
||||
try {
|
||||
bls = await getImplementation(isNode ? "blst-native" : "herumi");
|
||||
} catch (e) {
|
||||
bls = await getImplementation("herumi");
|
||||
}
|
||||
|
||||
export default bls;
|
||||
|
|
Reference in New Issue