Compare commits
No commits in common. "99f7fe9976ebffa4d0b792df0ebd3c61f41bf8f1" and "a74045db4a6dc9732b0c608b482d8aaf669b1a21" have entirely different histories.
99f7fe9976
...
a74045db4a
|
@ -1,3 +1,3 @@
|
||||||
import type { IBls } from "./types.js";
|
import type { IBls } from "./types.js";
|
||||||
export declare const bls: () => Promise<IBls>;
|
declare let bls: IBls;
|
||||||
export default bls;
|
export default bls;
|
||||||
|
|
17
lib/index.js
17
lib/index.js
|
@ -1,14 +1,11 @@
|
||||||
import { getImplementation } from "./getImplementation.js";
|
import { getImplementation } from "./getImplementation.js";
|
||||||
// Thanks https://github.com/iliakan/detect-node/blob/master/index.esm.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 isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
|
||||||
export const bls = async () => {
|
let bls;
|
||||||
let bls;
|
try {
|
||||||
try {
|
bls = await getImplementation(isNode ? "blst-native" : "herumi");
|
||||||
bls = await getImplementation(isNode ? "blst-native" : "herumi");
|
}
|
||||||
}
|
catch (e) {
|
||||||
catch (e) {
|
bls = await getImplementation("herumi");
|
||||||
bls = await getImplementation("herumi");
|
}
|
||||||
}
|
|
||||||
return bls;
|
|
||||||
};
|
|
||||||
export default bls;
|
export default bls;
|
||||||
|
|
File diff suppressed because one or more lines are too long
17
src/index.ts
17
src/index.ts
|
@ -4,16 +4,11 @@ import {getImplementation} from "./getImplementation.js";
|
||||||
// Thanks https://github.com/iliakan/detect-node/blob/master/index.esm.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 isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
|
||||||
|
|
||||||
export const bls = async (): Promise<IBls> => {
|
let bls: IBls;
|
||||||
let bls: IBls;
|
try {
|
||||||
|
bls = await getImplementation(isNode ? "blst-native" : "herumi");
|
||||||
try {
|
} catch (e) {
|
||||||
bls = await getImplementation(isNode ? "blst-native" : "herumi");
|
bls = await getImplementation("herumi");
|
||||||
} catch (e) {
|
}
|
||||||
bls = await getImplementation("herumi");
|
|
||||||
}
|
|
||||||
|
|
||||||
return bls;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default bls;
|
export default bls;
|
||||||
|
|
Reference in New Issue