https://github.com/datadog/react-native-performance-limiter
## Auto-archived due to inactivity. ## A package for deliberately limiting the performance of React Native applications
https://github.com/datadog/react-native-performance-limiter
performance react-native
Last synced: over 1 year ago
JSON representation
## Auto-archived due to inactivity. ## A package for deliberately limiting the performance of React Native applications
- Host: GitHub
- URL: https://github.com/datadog/react-native-performance-limiter
- Owner: DataDog
- License: apache-2.0
- Created: 2022-12-09T14:45:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-12T16:50:35.000Z (almost 3 years ago)
- Last Synced: 2025-01-18T02:14:18.440Z (over 1 year ago)
- Topics: performance, react-native
- Language: Java
- Homepage:
- Size: 1.65 MB
- Stars: 18
- Watchers: 8
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# 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
```sh
npm install react-native-performance-limiter
```
```sh
yarn add react-native-performance-limiter
```
Then re-install your pods:
```sh
(cd ios && pod install)
```
## Usage
### Block the javascript thread
```js
import { blockJavascriptThread } from 'react-native-performance-limiter';
blockJavascriptThread(1000); // blocks javascript thread for 1 second
```
### Block the native main thread
```js
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:
```js
const myfun = async () => {
await blockNativeMainThread(1000);
// do something else afterwards
};
```
### Crash the app from the javascript thread
```js
import { crashJavascriptThread } from 'react-native-performance-limiter';
crashJavascriptThread('custom error message');
```
### Crash the app from the native main thread
```js
import { crashNativeMainThread } from 'react-native-performance-limiter';
crashNativeMainThread('custom error message');
```
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
---
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)