0.2.0 • Published 11 months ago

react-native-performance-limiter v0.2.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
11 months ago

react-native-performance-limiter

A package for intentionally lowering performance and generating crashes on React Native applications.

Use blockJavascriptThread and blockNativeMainThread to test your implementation of performance monitoring tools, crashJavascriptThread and crashNativeMainThread to test your implementation of crash reporting tools.

Installation

npm install react-native-performance-limiter
yarn install react-native-performance-limiter

Then re-install your pods:

(cd ios && pod install)

Usage

Block the javascript thread

import { blockJavascriptThread } from 'react-native-performance-limiter';

blockJavascriptThread(1000); // blocks javascript thread for 1 second

Block the native main thread

import { blockNativeMainThread } from 'react-native-performance-limiter';

blockNativeMainThread(1000); // blocks native main thread for 1 second

Inside functions you can await for the block to be finised:

const myfun = async () => {
  await blockNativeMainThread(1000);
  // do something else afterwards
};

Crash the app from the javascript thread

import { crashJavascriptThread } from 'react-native-performance-limiter';

crashJavascriptThread('custom error message');

Crash the app from the native main thread

import { crashNativeMainThread } from 'react-native-performance-limiter';

crashNativeMainThread('custom error message');

Contributing

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


Made with create-react-native-library