← packages
tab-leader
WEEKLY RELEASEElect one leader tab per browser session so timers and sockets run exactly once.
v0.1.0↓ 76/wk★ 127MIT#javascript
README
README.md
# tab-leader
Elect one leader tab per browser session so timers and sockets run exactly once.
## Install
```bash
npm i tab-leader
```
## Usage
```ts
import { createTabLeader } from "tab-leader";
const instance = createTabLeader({
timeout: 15 * 60 * 1000,
onIdle: () => console.warn("session expiring"),
});
```
## Why
Most projects reimplement this badly, once per codebase. This does it in one
place, with tests, and stays out of your way.
- Zero dependencies
- Fully typed
- MIT licensed