mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-05 16:28:17 +00:00
fix(js/algorithms/fast): handle old browsers
Closes #1082 Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
@@ -5,13 +5,16 @@ interface ProcessOptions {
|
||||
version: string;
|
||||
}
|
||||
|
||||
const getHardwareConcurrency = () =>
|
||||
navigator.hardwareConcurrency !== undefined ? navigator.hardwareConcurrency : 1;
|
||||
|
||||
export default function process(
|
||||
options: ProcessOptions,
|
||||
data: string,
|
||||
difficulty: number = 5,
|
||||
signal: AbortSignal | null = null,
|
||||
progressCallback?: ProgressCallback,
|
||||
threads: number = Math.trunc(Math.max(navigator.hardwareConcurrency / 2, 1)),
|
||||
threads: number = Math.trunc(Math.max(getHardwareConcurrency() / 2, 1)),
|
||||
): Promise<string> {
|
||||
console.debug("fast algo");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user