@okiba/worker-utils

0.1.25 • Public • Published

Okiba / worker-utils

Set of useful functions to ease WebWorkers development

__

Installation

npm i --save @okiba/worker-utils

Or import it directly in the browser

<script type="module" src="https://unpkg.com/@okiba/worker-utils/index.js"></script>

Usage

import worker-utils from '@okiba/worker-utils'

Untranspiled code 🛑

Okiba Core packages are not transpiled, so don't forget to transpile them with your favourite bundler. For example, using Babel with Webpack, you should prevent imports from okiba to be excluded from transpilation, like follows:

{
  test: /\.js$/,
  exclude: /node_modules\/(?!(@okiba)\/).*/,
  use: {
    loader: 'babel-loader',
    options: {
      presets: ['@babel/preset-env']
    }
  }
}

createWorker(fn)

Creates a web worker starting from a function

Arguments

+ fn: function

function to be included in the worker script, will be self-invoked

Returns

WebWorker worker running the passed script

Package Sidebar

Install

npm i @okiba/worker-utils

Weekly Downloads

0

Version

0.1.25

License

MIT

Unpacked Size

3.75 kB

Total Files

5

Last publish

Collaborators

  • fiad
  • ghzmdr
  • lavolpecheprogramma