1.2.14 • Published 8 years ago

react-idle-timer-babel6 v1.2.14

Weekly downloads
24
License
MIT
Repository
github
Last release
8 years ago

React Idle Timer

React.js port of jQuery.idleTimer with some extras.

:rocket: Now with Babel 6 and react-transform support

NPM

Installation

npm install react-idle-timer-babel6

Usage

check the examples directory for a working example

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
1.2.14

8 years ago

1.2.13

8 years ago

1.2.12

8 years ago

1.2.10

8 years ago

1.2.9

8 years ago

1.2.8

8 years ago

1.2.6

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.0

8 years ago