npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

luminexis

v1.0.0

Published

Lightweight user idle detection library with warnings and auto-logout support

Readme

License: MIT npm version Downloads TypeScript Zero Dependencies

Version 1.0.0 - Production Release 🎉

View on npmjs.com


Table of Contents


About

Luminexis is a lightweight, zero-dependency library for detecting user idle state in web applications. It monitors user activity (mouse, keyboard, touch) and triggers events when the user becomes idle. Built with TypeScript from the ground up, it provides type-safe idle detection for modern web applications.


Features

  • Human-Readable Time: Use formats like '30s', '5m', '1h', '2d' instead of milliseconds
  • Warning System: Fire events before idle trigger to warn users
  • Whitelist: Ignore activity from specific elements (e.g., video players)
  • Events: idle, active, warning, tick events for reactive programming
  • TypeScript Support: Full type definitions included
  • Cross-Tab Sync: Synchronize idle state across browser tabs
  • Dynamic Configuration: Change timeout on the fly
  • Zero Dependencies: Pure TypeScript implementation

Installation

npm install luminexis
# or
yarn add luminexis
# or
pnpm add luminexis
# or
bun add luminexis

Quick Start

Basic Auto-Logout

import Luminexis from "luminexis";

const idle = new Luminexis({
  timeout: "15m",
  warning: "1m",
  immediate: true,
});

idle.on("warning", () => {
  showNotification("You will be logged out in 1 minute due to inactivity");
});

idle.on("idle", () => {
  logout();
  window.location.href = "/login";
});

Save Draft on Idle

import Luminexis from "luminexis";

const idle = new Luminexis({ timeout: "30s" });

idle.on("idle", () => {
  saveDraft();
  showNotification("Draft auto-saved");
});

idle.on("active", () => {
  console.log("User is back");
});

idle.start();

API Reference

Constructor

new Luminexis(options?: LuminexisOptions)

Constructor Options:

| Option | Type | Default | Description | | ----------- | ------------------ | -------------- | -------------------------------------------- | | timeout | string \| number | '5m' | Idle timeout duration (e.g., '5m', '1h') | | warning | string \| number | null | Warning time before idle trigger | | events | string[] | Default events | Events that reset idle timer | | whitelist | string[] | [] | CSS selectors for elements to ignore | | immediate | boolean | false | Start monitoring immediately |

Time Formats

  • '30s' - 30 seconds
  • '5m' - 5 minutes
  • '1h' - 1 hour
  • '1d' - 1 day
  • '1w' - 1 week
  • '1h30m' - 1 hour 30 minutes
  • '2d12h' - 2 days 12 hours

Methods

start()

Begin monitoring user activity.

const idle = new Luminexis({ timeout: "10m" });
idle.start();

stop()

Pause monitoring without resetting state.

idle.stop();

reset()

Manually reset the idle timer.

document.getElementById("custom-btn").addEventListener("click", () => {
  idle.reset();
});

isIdle()

Check if user is currently idle.

if (idle.isIdle()) {
  console.log("User is AFK");
}

isRunning()

Check if monitoring is active.

console.log(idle.isRunning()); // true or false

getIdleTime()

Get how long user has been idle (in milliseconds).

const idleMs = idle.getIdleTime();
console.log(`Idle for ${idleMs / 1000} seconds`);

getRemainingTime()

Get time remaining until idle trigger (in milliseconds).

const remainingMs = idle.getRemainingTime();
console.log(`Idle in ${remainingMs / 1000} seconds`);

setTimeout(timeout)

Dynamically change the timeout.

idle.setTimeout("30m"); // Extend to 30 minutes

getInfo()

Get current configuration and state.

const info = idle.getInfo();
console.log(info);
// {
//   timeout: 300000,
//   timeoutFormatted: '5m',
//   warning: 60000,
//   warningFormatted: '1m',
//   isIdle: false,
//   isRunning: true,
//   idleTime: 0,
//   remainingTime: 240000,
//   events: [...],
//   whitelist: [...]
// }

destroy()

Complete cleanup for SPA navigation.

window.addEventListener("beforeunload", () => {
  idle.destroy();
});

Events

| Event | Callback | Description | | --------- | ------------------------------- | ------------------------------------ | | idle | () => void | Fired when user becomes idle | | active | () => void | Fired when user returns from idle | | warning | (remainingMs: number) => void | Fired when warning threshold reached | | tick | (idleTime: number) => void | Fired every second while idle |


Examples

Auto-Logout with Warning

const idle = new Luminexis({
  timeout: "15m",
  warning: "1m",
  immediate: true,
});

idle.on("warning", () => {
  showModal("Your session will expire in 1 minute. Click to stay logged in.");
});

idle.on("idle", () => {
  logout();
  window.location.href = "/login";
});

Video Player Whitelist

const idle = new Luminexis({
  timeout: "5m",
  whitelist: [".video-player", ".live-stream", "[data-idle-ignore]"],
  immediate: true,
});

// User watching video won't trigger idle
// But clicking outside the player will reset the timer

Activity Dashboard

const idle = new Luminexis({ timeout: "1h" });

idle.on("tick", (idleTime) => {
  const minutes = Math.floor(idleTime / 1000 / 60);
  document.getElementById("idle-timer").textContent = `Idle: ${minutes}m`;
});

idle.on("active", () => {
  document.getElementById("status").textContent = "Active";
  document.getElementById("status").className = "badge green";
});

idle.on("idle", () => {
  document.getElementById("status").textContent = "Away";
  document.getElementById("status").className = "badge gray";
});

idle.start();

Countdown Timer

const idle = new Luminexis({ timeout: "5m" });

function updateCountdown() {
  const remaining = idle.getRemainingTime();
  const seconds = Math.ceil(remaining / 1000);
  document.getElementById("countdown").textContent = `${seconds}s`;
}

setInterval(updateCountdown, 1000);
idle.start();

Browser Compatibility

| Browser | Minimum Version | | ------- | --------------- | | Chrome | 90+ | | Firefox | 88+ | | Safari | 14+ | | Edge | 90+ |


Contributing

Contributions are welcome! Please see AGENTS.md for guidelines.

Development Setup

git clone https://github.com/dotjumpdot/luminexis.git
cd luminexis
bun install

Development Commands

bun run build          # Build TypeScript
bun run test           # Run tests
bun run test:watch     # Run tests in watch mode
bun run test:coverage  # Run tests with coverage
bun run lint           # Run linter

License

MIT License - Copyright (c) 2026 DotJumpDot


Changelog

See CHANGELOG.md for version history.


Support


Made with ❤️ by DotJumpDot

⬆ Back to Top