获取JavaScript中的CPU核心数量? [英] Get number of CPU cores in JavaScript?

查看:116
本文介绍了获取JavaScript中的CPU核心数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法确定JavaScript中可用的CPU核心数量,以便您可以根据需要调整Web工作者的数量?

Is there a way to determine the number of available CPU cores in JavaScript, so that you could adjust the number of web workers depending on that?

推荐答案

是的, navigator.hardwareConcurrency 。 Chrome,Firefox,Edge,Opera和Webkit本身支持;所有浏览器都支持填充

Yes, navigator.hardwareConcurrency. Supported natively in Chrome, Firefox, Edge, Opera, and Webkit; supported in all browsers with a polyfill.

这篇关于获取JavaScript中的CPU核心数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆