@companycam/vibe-检查
CompanyCam 的硬件记录库
欢迎来到Cam Vibe Check Repo公司.
该图书馆主要用于披露不易获得的硬件信息。 在我们的应用中保持高水平的性能是一大优先事项. 有时我们可以补偿这些问题,有时我们无法。 该图书馆旨在揭露通常与性能问题有关的硬件信息.
该图书馆通过图书馆披露以下信息: getCurrentVibes 方法 :
{
battery: {
batteryLevel: 0.70202270953611340,
batteryState: 'charging',
lowPowerMode: false,
},
connectivity: {
connection: {
isConnected: true,
isInternetReachable: true,
type: 'cellular',
details: {
isConnectionExpensive: false,
cellularGeneration: '4g',
},
},
},
memoryInUse: 83193856,
thermalState: 'nominal',
};
安装
yarn install @companycam/vibe-check
yarn add @companycam/vibe-check
系统要求
iOS系统
iOS Version: 15.0
机器人
minSdkVersion: 24
使用量
import { getCurrentVibes, FullVibeCheck } from '@companycam/vibe-check';
// ...elsewhere in your code
const vibes: FullVibeCheck = yield call(getCurrentVibes);
API 密码
方法
获取当前维布斯( )
获取设备当前硬件信息 。 这种方法是这个库的主要切入点. 返回此库所显示的其他函数的全部结果 .
import { getCurrentVibes, FullVibeCheck } from '@companycam/vibe-check';
const vibes: FullVibeCheck = yield call(getCurrentVibes);
此方法将返回一个与以下 JSON 对象非常相近的对象 :
{
battery: {
batteryLevel: 0.70202270953611340,
batteryState: 'charging',
lowPowerMode: false,
},
connectivity: {
connection: {
isConnected: true,
isInternetReachable: true,
type: 'cellular',
details: {
isConnectionExpensive: false,
cellularGeneration: '4g',
},
},
},
memoryInUse: 83193856,
thermalState: 'nominal',
};
获得Batterry Vibe ()
获取设备当前电池信息.
import { VibeChecker } from '@companycam/companycam-vibe-check';
const { battery } = await NativeModules.VibeChecker.getBatteryVibe();
此方法将返回一个与以下 JSON 对象非常相近的对象 :
battery: {
batteryLevel: 0.5,
batteryState: 'unplugged',
lowPowerMode: false,
isBatteryCharging: false,
}
获取连接Info ()
获取设备当前网络连接信息 .
import { getConnectionInfo } from '@companycam/vibe-check';
const { connection } = await getConnectionInfo();
此方法将返回一个与以下 JSON 对象非常相近的对象 :
connection: {
isConnected: true,
isInternetReachable: true,
type: 'cellular',
details: {
isConnectionExpensive: false,
cellularGeneration: '4g',
},
}
获取 RamUsage ()
获得设备当前内存的使用率, 百分比 .
import { getRamUsage } from '@companycam/vibe-check';
const { ramUsage } = await getRamUsage();
此方法将返回一个与以下 JSON 对象非常相近的对象 :
ramUsage: 0.8; // <-- percentage
获得热态 ()
获得设备当前热能状态.
import { getThermalState } from '@companycam/vibe-check';
const { thermalState } = await getThermalState();
此方法将返回一个与以下 JSON 对象非常相近的对象 :
thermalState: 'fair';
注:自 iOS 财务报告和审定财务报表 Android 暴露不同的热能状态,我们已经把它们正常化了。 目前我们使用 iOS 不同热态的术语。 请参看下表.
| 热态 | iOS 值 | 安卓价值 |
|---|---|---|
nominal | nominal | THERMAL_STATUS_NONE / THERMAL_STATUS_LIGHT |
fair | fair | THERMAL_STATUS_MODERATE |
serious | serious | THERMAL_STATUS_SEVERE |
critical | critical | THERMAL_STATUS_CRITICAL / THERMAL_STATUS_EMERGENCY |
unknown | unknown | unknown |
返回对象潜在值
电池
| 财产 | 类型 | 说明 |
|---|---|---|
batteryLevel | number | The battery level on the device, from 0.0 to 1.0 |
batteryState | string | unknown, (中文(简体) ), unplugged, (中文(简体) ), charging, (中文(简体) ), full |
lowPowerMode | bool | Whether or not the device is in low power mode |
连通性
| 财产 | 类型 | 说明 |
|---|---|---|
isConnected | bool | Whether or not the device is connected to the internet |
isInternetReachable | bool | Whether or not the device is connected to the internet |
type | string | none, (中文(简体) ), unknown, (中文(简体) ), cellular, (中文(简体) ), wifi, (中文(简体) ), bluetooth, (中文(简体) ), ethernet, (中文(简体) ), wimax, (中文(简体) ), vpn |
details | object | See below |
连接细节
| 财产 | 类型 | 说明 |
|---|---|---|
isConnectionExpensive | bool | Whether or not the connection is expensive |
cellularGeneration | string | 2g, (中文(简体) ), 3g, (中文(简体) ), 4g, (中文(简体) ), 5g, (中文(简体) ), unknown |
热态
| 财产 | 类型 | 说明 |
|---|---|---|
thermalState | string | nominal, (中文(简体) ), fair, (中文(简体) ), serious, (中文(简体) ), critical |
内存使用
| 财产 | 类型 | 说明 |
|---|---|---|
ramUsage | number | RAM Usage on the device from 0.0 to 1.0 |
捐款
该项目使用常规承诺和语义释放使释放过程自动化。 请跟随 常规承诺 格式中输入.
见 贡献指南 学习如何为储存库和发展工作流程作出贡献.
制造的 创建- 反应- 本土- 图书馆