Skip to content

Commit

Permalink
Mention the possibility of passing WorkerOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 10, 2021
1 parent fa27c2f commit 77ccdd7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ const worker = await spawn(BlobWorker.fromText(MyWorker))
Bundle this module and you will obtain a stand-alone bundle that has its worker inlined. This is particularly useful for libraries using threads.js.

### createWorker - select worker backend
`createWorker` allows selecting the worker backend (among web, node, and tiny), and also if you want a blob worker. The second argument to the `createWorker` is an object that specifies `backend: 'web' | 'node' | 'tiny'` and `blob: boolean`.
`createWorker` allows selecting the worker backend (among web, node, and tiny), and also if you want a blob worker.

The second argument to the `createWorker` is an object that specifies `backend: 'web' | 'node' | 'tiny'` and `blob: boolean`.
You can also pass other `WorkerOptions` in this object.

`createWorker` uses dynamic imports to only import the needed implementation, so you can import the needed functions directly to reduce the bundle size.

Expand Down

0 comments on commit 77ccdd7

Please sign in to comment.