# os-idle-timer

> Cross platform os idle timer

Latest version **1.0.7** (published 2016-10-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install os-idle-timer
pnpm add os-idle-timer
yarn add os-idle-timer
bun add os-idle-timer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2016-10-11 |
| First published | 2016-07-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 7 |
| Author | callsync@nomadconnection.com |
| Maintainers | goldworm |

## Links

- npm: https://www.npmjs.com/package/os-idle-timer
- Repository: https://github.com/nomadcn/node-os-idle-timer
- Homepage: https://github.com/nomadcn/node-os-idle-timer#readme
- Issues: https://github.com/nomadcn/node-os-idle-timer/issues
- npm.io page: https://npm.io/package/os-idle-timer

## Dependencies (2)

- [nan](https://npm.io/package/nan.md) 2.x
- [node-pre-gyp](https://npm.io/package/node-pre-gyp.md) 0.6.x

## Recent versions

- 1.0.7 (latest) — 2016-10-11
- 1.0.6 — 2016-07-13
- 1.0.5 — 2016-07-13
- 1.0.4 — 2016-07-13
- 1.0.3 — 2016-07-12
- 1.0.2 — 2016-07-07
- 1.0.1 — 2016-07-07

## README

# os-idle-timer
Detect user's system inactivity.  
Windows and Mac only

# Requisites
* windows: msvs
* mac: xcode

# Installation
```
npm install os-idle-timer
```

# Example
``` js
const idleTimer = require('os-idle-timer');

/**
 * Once an idleTimer callback is called,
 * it is automatically cleared from idleTimer.
 */
function callback(idleTime_ms) {
    console.log('idleTimer is called. ' + idleTime_ms);
}

// Set a new idle timer in milliseconds.
var handle = idleTimer.setIdleTimer(callback, 5000);

// Remove the idle timer indicated by handle.
idleTimer.clearIdleTimer(handle);

// Remove all idleTimers.
idleTimer.clearIdleTimers();

// Get the current idle time in milliseconds.
var idleTime_ms = idleTimer.getIdleTime_ms();
console.log(idleTime_ms);

setInterval(() => {
    console.log(idleTimer.getIdleTime_ms());
}, 2000);

idleTimer.setIdleTimer(callback, 5000);
```

---
_Source: https://npm.io/package/os-idle-timer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
