Stopping Javascript / angular watches when app paused

When user leaves application (application goes in background) application still consumes CPU (on android).

I think angular watches/evnethanlders are running.

I can define event handlers for pause and resume events like

document.addEventListener("resume", onResume, false);
document.addEventListener("pause", onPause, false);

But how to stop and resume Javascript execution.??

I found possible solution (keepruning preference) http://cordova.apache.org/docs/en/3.4.0/guide_platforms_android_config.md.html#Android%20Configuration

Yep. This is a problem I’m currently facing – how to make sure HTML5 video playback is paused when the app pauses