The documentation provides both a detailed example and a brief example of events, with the following code snippet being an illustration:
document.addEventListener("pause", onPause, false);
function onPause() {
// Handle the pause event
}
Similar to regular JavaScript syntax, event listeners can be added using the addEventListener
method on any node. For PhoneGap, these device events are triggered on the document
object.
If my understanding is correct and JQM refers to jQuery Mobile: With jQuery, it is possible to assign handlers for various events by utilizing:
$(document).on('pause', onPause);
(The above code represents the jQuery 1.7 syntax, which I believe is necessary for jQuery Mobile).