Skip to content

DataDog/react-native-performance-limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 add 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

About

A package for deliberately limiting the performance of React Native applications

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 5