npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@companycam/vibe-check

v0.2.0

Published

Hardware logging library for CompanyCam

Downloads

1,018

Readme

@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.

| thermalState | iOS Value | Android Value | | ------------ | ---------- | ---------------------------------------------------- | | 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 |

Return object potential values

Battery

| Property | Type | Description | | -------------- | -------- | -------------------------------------------------- | | 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 |

Connectivity

| Property | Type | Description | | --------------------- | -------- | ------------------------------------------------------------------------------ | | 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 |

Connectivity Details

| Property | Type | Description | | ----------------------- | -------- | -------------------------------------------- | | isConnectionExpensive | bool | Whether or not the connection is expensive | | cellularGeneration | string | 2g, 3g, 4g, 5g, unknown |

Thermal State

| Property | Type | Description | | -------------- | -------- | ---------------------------------------- | | thermalState | string | nominal, fair, serious, critical |

RAM Usage

| Property | Type | Description | | ---------- | -------- | ----------------------------------------- | | ramUsage | number | RAM 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