Allows you to run JavaScript when the app is active and for 3 minutes after the app is suspended.
cordova plugin add https://github.com/filionf/cordova-plugin-background-task.git
You do not need to reference any JavaScript, the Cordova plugin architecture will add a backgroundtask object to your root automatically when you build.
backgroundtask.start(functionToRun);
iOS only.