Worker Sync
JavaScript synchronization functions (mutex, semaphore) between workers (and the main thread).
Setup
NodeJS
Released under both npmjs & github packages:
Install:
npm
npm install @eyalsh/worker_sync
yarn
yarn add @eyal-shalev/worker_sync
import (ES Modules):
import { Mutex, Semaphore } from "@eyalsh/worker_sync";
require (CommonJS):
const { Semaphore, Mutex } = require("@eyalsh/worker_sync");
Deno
The library is available to import from deno.land/x/worker_sync
import { Mutex, Semaphore } from "https://deno.land/x/worker_sync/mod.ts";
Browser - Download
You can download compiled library from GitHub:
import { Mutex, Semaphore } from "/path/to/worker_sync.esm.min.js";
Note: a bundled IIFE version also exist, if your application doesn’t support ES modules.
<script src="/path/to/worker_sync.iife.min.js"></script>
<script>
const {Semaphore, Mutex} = worker_sync;
</script>