mirror of
https://github.com/moparisthebest/kaiwa
synced 2025-02-16 15:10:11 -05:00
Move focus check
This commit is contained in:
parent
6052aca7b2
commit
a772ccb57c
@ -24,20 +24,6 @@ module.exports = {
|
|||||||
window.location = '/login';
|
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);
|
config = JSON.parse(config);
|
||||||
|
|
||||||
_.extend(this, Backbone.Events);
|
_.extend(this, Backbone.Events);
|
||||||
@ -58,6 +44,20 @@ module.exports = {
|
|||||||
function (cb) {
|
function (cb) {
|
||||||
window.me = new MeModel();
|
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);
|
self.api = window.client = XMPP.createClient(config);
|
||||||
xmppEventHandlers(self.api, self);
|
xmppEventHandlers(self.api, self);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user