use-webworker
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

use-webworker

A react hook wrapper over webworker exposing message data from worker as state

Build Status version min size mingzip size license

dependancies downloads all contributors code of conduct

stargazers number of forks

👏 & ❤️ to auto badger for making badging simple

Install

npm install --save use-webworker

Usage

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 <h1>Loading...</h1>
  }
  return <h1>{dataFromWorker}</h1>
}

License

MIT © technikhil314

/use-webworker/

    Package Sidebar

    Install

    npm i use-webworker

    Weekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    8.65 kB

    Total Files

    8

    Last publish

    Collaborators

    • nikhil.001mehta