@nexus-state/web-worker
v0.1.5
Published
> Nexus State integration with Web Workers — offload heavy computations > > [](https://www.npmjs.com/package/@nexus-state/web-worker) > [
- Related:
- @nexus-state/async — Simple async state
- @nexus-state/query — Data fetching with caching
Full ecosystem: Nexus State Packages
Description
The @nexus-state/web-worker package provides tools for working with Nexus State in Web Workers.
Installation
npm install @nexus-state/web-workerKey Features
- Moving state logic to Web Workers
- Asynchronous processing of heavy operations
- Communication between main thread and Web Worker
Usage Example
import { createWorkerStore } from '@nexus-state/web-worker';
const workerStore = createWorkerStore({
calculations: []
});
// Performing heavy computations in Web Worker
workerStore.dispatch({
type: 'CALCULATE',
payload: largeDataSet
});
// Subscribing to results
workerStore.subscribe((state) => {
>
> [](https://coveralls.io/github/eustatos/nexus-state?branch=main)
console.log('Calculation results:', state.calculations);
});License
MIT
