Skip to content
Utils for detecting inactive clients
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
README.md
jquery.away.js

README.md

jquery-away

Utils for detecting inactive clients

Usage example

setInterval(function() {
    console.log('idle time: ' + $.idle());
}, 2000);

$.idle(30, function() {
    console.log('are you there?');
});

$.idle(60, function() {
    console.log('going away :)');
    $.away('autoaway');
});

$.idle(0, function() {
    if ($.isAway()) {
        console.log('back from away');
        $.away();
    }
});

License

Released under the MIT license http://www.opensource.org/licenses/mit-license.php

Functions

$.idle()

Return idle time in seconds

$.idle(n)

Return registered callbacks for specified seconds

$.idle(n, function)

Register a callback to be run when N idle seconds occurs

$.away(message)

Mark the client as away

$.away()

Mark the client as not away

$.isAway()

Return wether the client is away or not

Something went wrong with that request. Please try again.