1

I'm doing this to listen for pause event in Cordova:

$(document).on('pause', function( e ) { ... });

and now I need to check whether the pause event is attached to $(document).

I have tried to do: $._data($(document), 'events') and $.data($(document), 'events') but they always return undefined.

Any solution?

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
Frank
  • 1,919
  • 8
  • 32
  • 50

2 Answers2

1

Try this:

document.addEventListener("pause", onPause, false);
document.addEventListener("resume", onResume, false);
Joerg
  • 3,131
  • 2
  • 21
  • 29
1

You should pass DOM object and not jquery object, work like this :

$._data(document, 'events')
$.data(document, 'events')

Or with jquery object like :

$(document).data("events");

Take a look at jQuery object and DOM element.

Hope this helps.

Community
  • 1
  • 1
Zakaria Acharki
  • 65,304
  • 15
  • 70
  • 95