Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/margelo/react-native-worklets-core
๐งต A library to run JS functions ("Worklets") on separate Threads
https://github.com/margelo/react-native-worklets-core
async background hacktoberfest multithreading native react threads worklet worklets
Last synced: 4 days ago
JSON representation
๐งต A library to run JS functions ("Worklets") on separate Threads
- Host: GitHub
- URL: https://github.com/margelo/react-native-worklets-core
- Owner: margelo
- License: mit
- Created: 2021-11-11T18:24:15.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-21T15:25:08.000Z (6 months ago)
- Last Synced: 2024-05-22T02:38:30.527Z (6 months ago)
- Topics: async, background, hacktoberfest, multithreading, native, react, threads, worklet, worklets
- Language: C++
- Homepage: https://margelo.io
- Size: 4.13 MB
- Stars: 467
- Watchers: 10
- Forks: 29
- Open Issues: 32
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ๐งต react-native-worklets-core
A [Worklet](docs/WORKLETS.md) runner for React Native.
```js
const worklet = () => {
'worklet'
return Math.random()
}
```> [!NOTE]
> In most cases, react-native-worklets-core shouldn't be used as a standalone dependency but rather as a peer-dependency for other modules such as [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera), [react-native-wishlist](https://github.com/margelo/react-native-wishlist), or [react-native-skia](https://github.com/Shopify/react-native-skia).## Installation
1. Install the library from npm:
```sh
yarn add react-native-worklets-core
```
2. Add the babel plugin to your `babel.config.js`:
```js
module.exports = {
plugins: [
["react-native-worklets-core/plugin"],
// ...
],
// ...
};
```
3. Restart Metro with clean cache:
```sh
yarn start --reset-cache
```## Usage
See [USAGE.md](docs/USAGE.md)
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT
## Credits
* Credits go to [Christian Falch](https://github.com/chrfalch) for building the initial version of this library. You're amazing! ๐คฉ
* Credits go to [Software Mansion](https://swmansion.com) for introducing the concept of [Worklets](https://docs.swmansion.com/react-native-reanimated/docs/2.x/fundamentals/worklets/) in [Reanimated v2](https://github.com/software-mansion/react-native-reanimated). This library is inspired by Reanimated v2 with a few structural changes to the Worklets architecture to make it more flexible for different use-cases, such as integrating it with other C++ libraries like VisionCamera and WishList.