# @palasimi/workers

> Promise-based request-response API for dedicated web workers

Latest version **1.0.1** (published 2023-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @palasimi/workers
pnpm add @palasimi/workers
yarn add @palasimi/workers
bun add @palasimi/workers
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-07-15 |
| First published | 2023-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Levi Gruspe |
| Maintainers | lggruspe |
| Keywords | web-workers, javascript, typescript, request-response, promises, api, promise-based |

## Links

- npm: https://www.npmjs.com/package/@palasimi/workers
- Repository: https://github.com/palasimi/palasimi-workers
- Homepage: https://github.com/palasimi/palasimi-workers#readme
- Issues: https://github.com/palasimi/palasimi-workers/issues
- npm.io page: https://npm.io/package/@palasimi/workers

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-07-15
- 1.0.0 — 2023-07-03

## README

# palasimi-workers

Promise-based request-response API for dedicated web workers.

## Installation

```bash
npm i @palasimi/workers
```

## Usage

```typescript
// worker.ts, compiles to /dist/worker.js
import { initServer } from "@palasimi/workers";

initServer({
  ping: () => "pong",
  pong: () => "ping",
  add: (xs) => xs.reduce((x, y) => x + y),
});

// index.ts
import { initClient } from "@palasimi/workers";

const worker = new Worker("/dist/worker.js");
const call = initClient(worker);

call({ name: "ping" }).then(console.log);
// {id: 1, name: 'ping', value: 'pong', status: 2}

call({ name: "pong" }).then(console.log);
// {id: 2, name: 'pong', value: 'ping', status: 2}

call({ name: "add", value: [1, 2, 3, 4, 5] }).then(console.log);
// {id: 3, name: 'add', value: 15, status: 2}
```

## License

[MIT](./LICENSE)

---
_Source: https://npm.io/package/@palasimi/workers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
