Commit a6c821be authored by JC Brand's avatar JC Brand

Use optional chaining

parent 377dad49
...@@ -175,17 +175,14 @@ converse.plugins.add('converse-status', { ...@@ -175,17 +175,14 @@ converse.plugins.add('converse-status', {
} }
_converse.idle_seconds = 0; _converse.idle_seconds = 0;
_converse.auto_changed_status = false; // Was the user's status changed by Converse? _converse.auto_changed_status = false; // Was the user's status changed by Converse?
const { unloadevent } = _converse;
window.addEventListener('click', _converse.onUserActivity); window.addEventListener('click', _converse.onUserActivity);
window.addEventListener('focus', _converse.onUserActivity); window.addEventListener('focus', _converse.onUserActivity);
window.addEventListener('keypress', _converse.onUserActivity); window.addEventListener('keypress', _converse.onUserActivity);
window.addEventListener('mousemove', _converse.onUserActivity); window.addEventListener('mousemove', _converse.onUserActivity);
const options = {'once': true, 'passive': true}; window.addEventListener(unloadevent, _converse.onUserActivity, {'once': true, 'passive': true});
window.addEventListener(_converse.unloadevent, _converse.onUserActivity, options); window.addEventListener(unloadevent, () => _converse.session?.save('active', false));
window.addEventListener(_converse.unloadevent, () => {
if (_converse.session) {
_converse.session.save('active', false);
}
});
_converse.everySecondTrigger = window.setInterval(_converse.onEverySecond, 1000); _converse.everySecondTrigger = window.setInterval(_converse.onEverySecond, 1000);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment