Clone wiki

jquery.wakeup plugin / Home

JQuery.wakeup plugin

A JQuery plugin that will help detecting waking up from sleep and/or hibernation and executing assigned functions.

Based on code provided by Andrew Mu:


<script src="jquery.min.js" />
<script src="jquery.wakeup.js" />


$.wakeUp(callback_function, parameters, interval);


// assign a handler function to be executed after waking up
var bell_id = $.wakeUp(function(sleep_time) {
    alert("I have slept for " + sleep_time/1000 + " seconds")

// remove this handler

// remove all handlers

In complex applications (such as RIA) use additional parameter interval (time in miliseconds) to prevent plugin from glitching.

You can also pass additional parameters object to a handler function.

var bell_id = $.wakeUp(function(sleep_time, params) {
    alert("Hello " + params[name] + ", I've slept for " + sleep_time/1000 + " seconds.")
}, {name: "Paul"}, 300 000);