/** * Liveness through Web Locks. * * A `MessagePort` never reports that the other side died, but a Web Lock * does: a lock held by a page, a worker or a ServiceWorker is released by the * browser the moment that context goes away, and a request waiting for it is * granted then. So each side that must notice the other's death holds a lock * of its own and watches the other's: * * - a handler holds an owner lock; the ServiceWorker watches it, and fails the * handler's requests in flight when it is granted (the tab closed, the * worker was terminated); * - the ServiceWorker holds a router lock; handlers watch it, and fail their * calls through it when it is granted (the browser stopped the worker). * * Every function here degrades to a no-op where `navigator.locks` is missing. */ export declare function locksAvailable(): boolean; /** A fresh lock name: `:`. */ export declare function newLockName(prefix: string): string; /** * Takes the lock `name` and holds it until the returned release is called or * this context dies. Resolves once the lock is held; with no Web Locks, * resolves at once. */ export declare function holdLock(name: string): Promise<() => void>; /** * Calls `onLost` once the lock `name` is granted to this context — that is, * once whoever holds it is gone — and releases it at once. Returns a function * that stops watching. With no Web Locks, never calls `onLost`. */ export declare function watchLock(name: string, onLost: () => void): () => void; /** * The names of the locks held right now in this origin, or `undefined` where * that cannot be asked. A backup for `watchLock`: a grant can be late, a query * cannot. */ export declare function heldLockNames(): Promise | undefined>; //# sourceMappingURL=locks.d.ts.map