mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-12-23 16:18:48 -05:00
Move focus check
This commit is contained in:
parent
6052aca7b2
commit
a772ccb57c
@ -24,20 +24,6 @@ module.exports = {
|
||||
window.location = '/login';
|
||||
}
|
||||
|
||||
me.hasFocus = false;
|
||||
$(window).blur(function () {
|
||||
me.hasFocus = false;
|
||||
});
|
||||
$(window).focus(function () {
|
||||
me.hasFocus = true;
|
||||
});
|
||||
window.onbeforeunload = function () {
|
||||
if (client.sessionStarted) {
|
||||
client.disconnect();
|
||||
return "End active session?";
|
||||
}
|
||||
};
|
||||
|
||||
config = JSON.parse(config);
|
||||
|
||||
_.extend(this, Backbone.Events);
|
||||
@ -58,6 +44,20 @@ module.exports = {
|
||||
function (cb) {
|
||||
window.me = new MeModel();
|
||||
|
||||
me.hasFocus = false;
|
||||
$(window).blur(function () {
|
||||
me.hasFocus = false;
|
||||
});
|
||||
$(window).focus(function () {
|
||||
me.hasFocus = true;
|
||||
});
|
||||
window.onbeforeunload = function () {
|
||||
if (client.sessionStarted) {
|
||||
client.disconnect();
|
||||
return "End active session?";
|
||||
}
|
||||
};
|
||||
|
||||
self.api = window.client = XMPP.createClient(config);
|
||||
xmppEventHandlers(self.api, self);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user