Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@companycam/vibe-check

Package Overview
Dependencies
Maintainers
73
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@companycam/vibe-check

Hardware logging library for CompanyCam

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
73
Created
Source

@companycam/vibe-check

Hardware logging library for CompanyCam

Welcome to the CompanyCam Vibe Check repo.

This library is largely for exposing hardware information not readily available. Maintaining a high level of performance in our apps is a large priority. Sometimes we can compensate for these issues, and sometimes we cannot. This library aims to expose hardware information commonly related to performance issues.

This library exposes the following information, through the getCurrentVibes method:

{
  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',
};

Installation

yarn install @companycam/vibe-check
yarn add @companycam/vibe-check

System Requirements

iOS

iOS Version: 15.0

Android

minSdkVersion: 24

Usage

import { getCurrentVibes, FullVibeCheck } from '@companycam/vibe-check';

// ...elsewhere in your code

const vibes: FullVibeCheck = yield call(getCurrentVibes);

API

Methods

getCurrentVibes()

Gets the device's current hardware information. This method is the main entry point for this library. Returns all of the results from the other functions this library exposes.

import { getCurrentVibes, FullVibeCheck } from '@companycam/vibe-check';

const vibes: FullVibeCheck = yield call(getCurrentVibes);

This method will return an object very similar to the below JSON object:

{
  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',
};

getBatteryVibe()

Gets the device's current Battery information.

import { VibeChecker } from '@companycam/companycam-vibe-check';

const { battery } = await NativeModules.VibeChecker.getBatteryVibe();

This method will return an object very similar to the below JSON object:

  battery: {
    batteryLevel: 0.5,
    batteryState: 'unplugged',
    lowPowerMode: false,
    isBatteryCharging: false,
  }

getConnectionInfo()

Gets the device's current Network Connection information.

import { getConnectionInfo } from '@companycam/vibe-check';

const { connection } = await getConnectionInfo();

This method will return an object very similar to the below JSON object:

  connection: {
    isConnected: true,
    isInternetReachable: true,
    type: 'cellular',
    details: {
      isConnectionExpensive: false,
      cellularGeneration: '4g',
    },
  }

getRamUsage()

Gets the device's current RAM usage, as a percentage.

import { getRamUsage } from '@companycam/vibe-check';

const { ramUsage } = await getRamUsage();

This method will return an object very similar to the below JSON object:

ramUsage: 0.8; // <-- percentage

getThermalState()

Gets the device's current thermal state.

import { getThermalState } from '@companycam/vibe-check';

const { thermalState } = await getThermalState();

This method will return an object very similar to the below JSON object:

thermalState: 'fair';

📝 NOTE: Since iOS and Android expose different thermal states, we've normalized them. Currently we use iOS nomenclature for the different thermal states. Please refer to the table below.

thermalStateiOS ValueAndroid Value
nominalnominalTHERMAL_STATUS_NONE / THERMAL_STATUS_LIGHT
fairfairTHERMAL_STATUS_MODERATE
seriousseriousTHERMAL_STATUS_SEVERE
criticalcriticalTHERMAL_STATUS_CRITICAL / THERMAL_STATUS_EMERGENCY
unknownunknownunknown

Return object potential values

Battery
PropertyTypeDescription
batteryLevelnumberThe battery level on the device, from 0.0 to 1.0
batteryStatestringunknown, unplugged, charging, full
lowPowerModeboolWhether or not the device is in low power mode
Connectivity
PropertyTypeDescription
isConnectedboolWhether or not the device is connected to the internet
isInternetReachableboolWhether or not the device is connected to the internet
typestringnone, unknown, cellular, wifi, bluetooth, ethernet, wimax, vpn
detailsobjectSee below
Connectivity Details
PropertyTypeDescription
isConnectionExpensiveboolWhether or not the connection is expensive
cellularGenerationstring2g, 3g, 4g, 5g, unknown
Thermal State
PropertyTypeDescription
thermalStatestringnominal, fair, serious, critical
RAM Usage
PropertyTypeDescription
ramUsagenumberRAM Usage on the device from 0.0 to 1.0

Contributing

This project uses conventional commits and semantic-release to automate the release process. Please follow the conventional commits format when making commits.

See the contributing guide to learn how to contribute to the repository and the development workflow.

Made with create-react-native-library

Keywords

FAQs

Package last updated on 18 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc