Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

lock: distributed lock

Forked from @stevekrouse/dlock! 🙏

Example:

import { acquireLock } from "https://esm.town/v/postpostscript/lock"; using exampleLock = await acquireLock(); // lock will be released when it goes out of context

Full Example

Options:

using exampleLock = await acquireLock({ id: "lockExample", retries: 0, ttl: 5, // seconds retryTimeout: 1000, // ms });

Migrated from folder: State/lock