Files
Jason Woltje f5792c40be feat: Complete fleet — 94 skills across 10+ domains
Pulled ALL skills from 15 source repositories:
- anthropics/skills: 16 (docs, design, MCP, testing)
- obra/superpowers: 14 (TDD, debugging, agents, planning)
- coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth)
- better-auth/skills: 5 (auth patterns)
- vercel-labs/agent-skills: 5 (React, design, Vercel)
- antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo)
- Plus 13 individual skills from various repos

Mosaic Stack is not limited to coding — the Orchestrator and
subagents serve coding, business, design, marketing, writing,
logistics, analysis, and more.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:27:42 -06:00

61 lines
2.4 KiB
Markdown

---
category: Browser
related: useWebWorkerFn
---
# useWebWorker
Simple [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) registration and communication.
## Usage
```ts
import { useWebWorker } from '@vueuse/core'
const { data, post, terminate, worker } = useWebWorker('/path/to/worker.js')
```
| State | Type | Description |
| ------ | --------------------------------- | ---------------------------------------------------------------------------------------------------- |
| data | `Ref<any>` | Reference to the latest data received via the worker, can be watched to respond to incoming messages |
| worker | `ShallowRef<Worker \| undefined>` | Reference to the instance of the WebWorker |
| Method | Signature | Description |
| --------- | ----------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| post | `(message: any, transfer: Transferable[]): void`<br>`(message: any, options?: StructuredSerializeOptions \| undefined): void` | Sends data to the worker thread. |
| terminate | `() => void` | Stops and terminates the worker. |
## Type Declarations
```ts
type PostMessage = (typeof Worker.prototype)["postMessage"]
export interface UseWebWorkerReturn<Data = any> {
data: Ref<Data>
post: PostMessage
terminate: () => void
worker: ShallowRef<Worker | undefined>
}
type WorkerFn = (...args: unknown[]) => Worker
/**
* Simple Web Workers registration and communication.
*
* @see https://vueuse.org/useWebWorker
* @param url
* @param workerOptions
* @param options
*/
export declare function useWebWorker<T = any>(
url: string,
workerOptions?: WorkerOptions,
options?: ConfigurableWindow,
): UseWebWorkerReturn<T>
/**
* Simple Web Workers registration and communication.
*
* @see https://vueuse.org/useWebWorker
*/
export declare function useWebWorker<T = any>(
worker: Worker | WorkerFn,
): UseWebWorkerReturn<T>
```