https://github.com/technikhil314/use-webworker
A react hook wrapper over comlink for using web workers
https://github.com/technikhil314/use-webworker
Last synced: over 1 year ago
JSON representation
A react hook wrapper over comlink for using web workers
- Host: GitHub
- URL: https://github.com/technikhil314/use-webworker
- Owner: technikhil314
- Created: 2021-02-25T11:56:49.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-28T07:49:52.000Z (over 5 years ago)
- Last Synced: 2025-03-13T05:28:08.678Z (over 1 year ago)
- Language: TypeScript
- Size: 1.01 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# use-webworker
> A react hook wrapper over webworker exposing message data from worker as state
[//]: <> (start placeholder for auto-badger)
[](https://github.com/technikhil314/use-webworker/actions)
[](https://npmjs.org/use-webworker)
[](https://bundlephobia.com/result?p=use-webworker)
[](https://bundlephobia.com/result?p=use-webworker)
[](https://github.com/technikhil314/use-webworker/blob/master/LICENSE)
[](https://libraries.io/npm/use-webworker)
[](https://npmcharts.com/compare/use-webworker)
[](https://github.com/technikhil314/use-webworker/graphs/contributors)
[](https://github.com/technikhil314/use-webworker/blob/master/CODE_OF_CONDUCT.md)
[](https://github.com/technikhil314/use-webworker/stargazers)
[](https://github.com/technikhil314/use-webworker/fork)
###### :clap: & :heart: to [auto badger](https://github.com/technikhil314/auto-badger) for making badging simple
[//]: <> (end placeholder for auto-badger)
## Install
```bash
npm install --save use-webworker
```
## Usage
```tsx
import useWebworker from 'use-webworker'
function Example {
const {isProcessing, data: dataFromWorker } = useWebworker({
url: '/worker.js', // available at %PUBLIC_URL%/worker.js
data: {}
});
if(isProcessing) {
return
Loading...
}
return {dataFromWorker}
}
```
## License
MIT © [technikhil314](https://github.com/technikhil314)