Skip to content
Snippets Groups Projects
Unverified Commit 78d64a64 authored by graywolf336's avatar graywolf336
Browse files

Add the timer for disconnecting, one minute after going in the background it'll disconnect

parent 67c21c1b
No related branches found
No related tags found
No related merge requests found
/* globals UserPresence, readMessage */
var timer = undefined;
if (Meteor.isCordova) {
document.addEventListener('pause', () => {
UserPresence.setAway();
readMessage.disable();
Meteor.disconnect();
//Only disconnect after one minute of being in the background
timer = setTimeout(() => {
Meteor.disconnect();
timer = undefined;
}, 60000);
}, true);
document.addEventListener('resume', () => {
if (!_.isUndefined(timer)) {
clearTimeout(timer);
}
Meteor.reconnect();
UserPresence.setOnline();
readMessage.enable();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment