GithubHelp home page GithubHelp logo

h-wang / idle Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 33 KB

A simple javascript library to detect browser idle and perform actions.

License: MIT License

JavaScript 100.00%

idle's Introduction

idle.js

A simple javascript library to detect browser idle and perform actions.

Installation

npm install @linkorb/idle

Demo

Check the demo/ directory for an demonstration + example on how to use idle.js

How to use

To support idle.js in your application, you'll need to include a script tag in your html:

<script type="text/javascript" src="../idle.js"></script>

You may specify some global variables to tweak the behaviors.

// set redirect url (relative) after idle timeout
_idle('url', '/demo/logout.html');

// set escaped urls that no need to detect idle, e.g. logout page
_idle('escape', ['/demo/logout.html']);

// specifying a callback to replace the default redirect action
_idle('callback', function(){console.log('timeout')});

// customize idle time interval, in ms.
_idle('interval', 2000);

// enable debug mode
_idle('debug', true);

Build from source

To change the source file and build, simply use webpack.

# generates dist/tweak.js
webpack -d
# generates dist/tweak.min.js
webpack -p

License

MIT (see LICENSE)

Brought to you by the LinkORB Engineering team


Check out our other projects at linkorb.com/engineering.

Btw, we're hiring!

idle's People

Contributors

h-wang avatar

Stargazers

Daniel Sokil avatar Alejandro Lopez avatar Cong Peijun avatar  avatar Divine avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.