Created
June 23, 2019 01:01
-
-
Save Richienb/0f92cfb54a1c2ed4d14c3196d83ca2a4 to your computer and use it in GitHub Desktop.
Get core count
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export var cores = (() => { | |
| if (typeof process !== 'undefined' && process.release.name === 'node') { | |
| return require('os').cpus().length; | |
| } else if (typeof navigator !== 'undefined' && navigator.hardwareConcurrency !== 'undefined') { | |
| return navigator.hardwareConcurrency | |
| } else if (typeof window !== 'undefined') { | |
| console.log("Please use https://github.com/oftn-oswg/core-estimator") | |
| } | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment