# react-idle-timer-babel6

> Activity detection for React.js

Latest version **1.2.14** (published 2016-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-idle-timer-babel6
pnpm add react-idle-timer-babel6
yarn add react-idle-timer-babel6
bun add react-idle-timer-babel6
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.2.14 |
| Published | 2016-01-13 |
| First published | 2015-12-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1208 |
| Author | Randy Lebeau |
| Maintainers | cchamberlain |
| Keywords | react, idle, idletimer, timer, activity, active |

## Links

- npm: https://www.npmjs.com/package/react-idle-timer-babel6
- Repository: https://github.com/supremetechnopriest/react-idle-timer
- Homepage: https://github.com/supremetechnopriest/react-idle-timer#readme
- Issues: https://github.com/supremetechnopriest/react-idle-timer/issues
- npm.io page: https://npm.io/package/react-idle-timer-babel6

## Dependencies (1)

- [moment](https://npm.io/package/moment.md) ^2.10.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.14 (latest) — 2016-01-13
- 1.2.13 — 2016-01-13
- 1.2.12 — 2016-01-12
- 1.2.10 — 2016-01-08
- 1.2.9 — 2016-01-08
- 1.2.8 — 2016-01-07
- 1.2.6 — 2015-12-17
- 1.2.2 — 2015-12-17
- 1.2.0 — 2015-12-17

## README

# React Idle Timer
> React.js port of jQuery.idleTimer with some extras.

:rocket: **Now  with [Babel 6](https://github.com/babel/babel) and [react-transform](https://github.com/gaearon/babel-plugin-react-transform) support**

[![NPM](https://nodei.co/npm/react-idle-timer.png?downloads=true&stars=true)](https://npmjs.org/package/react-idle-timer/)

# Installation
`npm install react-idle-timer-babel6`

# Usage

> check the examples directory for a working example

```javascript
import React from 'react'
import IdleTimer from 'react-idle-timer-babel6';

class YourApp extends React.Component {
  constructor(props) {
    super(props)
  }

  render() {
    return (
      <IdleTimer
        ref="idleTimer"
        element={document}
        activeAction={this._onActive}
        idleAction={this._onIdle}
        timeout={this.state.timeout}
        format="MM-DD-YYYY HH:MM:ss.SSS">

        <h1>All your children</h1>

      </IdleTimer>
    )
  }
}
module.exports = YourApp

```

# Documentation

## Props

- **timeout** {*Number*} - Idle timeout in milliseconds
- **events** {*Array*} - Events to bind
- **idleAction** {*Function*} - Function to call on idle
- **activeAction** {*Function*} - Function to call on active
- **element** {*Object*} - Defaults to document, may pass a ref to another element
- **format** {*String*} - moment.js format string applied to `lastActiveTime`

## Methods

- **reset()** *{Void}* - Resets the idleTimer
- **pause()** *{Void}* - Pauses the idleTimer
- **resume()** *{Void}* - Resumes a paused idleTimer
- **getRemainingTime()** *{Number}* - Returns the remaining time in milliseconds
- **getElapsedTime()** *{Number}* - Returns the elapsed time in milliseconds
- **lastActiveTime()** *{String}* - Returns the last active time as a number or a formatted string if the `format` prop is defined
- **isIdle()** {*Boolean*} - Returns whether or not user is idle

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