Fix when hardwareConcurrency is undefined (#42)
This commit is contained in:
parent
94f43c7200
commit
f1220ecc57
3 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// https://dev.to/ratmd/simple-proof-of-work-in-javascript-3kgm
|
||||
|
||||
export function process(data, difficulty = 5, threads = navigator.hardwareConcurrency) {
|
||||
export function process(data, difficulty = 5, threads = (navigator.hardwareConcurrency || 1)) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let webWorkerURL = URL.createObjectURL(new Blob([
|
||||
'(', processTask(), ')()'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue