summaryrefslogtreecommitdiff
path: root/addons/bus/static/src
diff options
context:
space:
mode:
authorJérome Maes <jem@openerp.com>2015-06-01 16:37:07 +0200
committerAaron Bohy <aab@odoo.com>2015-09-01 20:16:08 +0200
commit4af96310721237d3640bbd162ff9ea84e627028d (patch)
tree2deb74fa477c9ea33b1a0a65199b96e2d6e5f02b /addons/bus/static/src
parent5907be1f335dc21934619a34fc928a19e7885211 (diff)
[MOV] mail, im_chat : move files and code from im_chat to mail and bus
- im_chat.session will be replaced by mail.channel - im_chat.shortode is renamed into mail.shortcode - im_chat.presence is moved to bus module - js and controller code is moved from im_chat to mail module This commit only move files, and modify manifests, bundles, ... The code will be adapt in the next commits.
Diffstat (limited to 'addons/bus/static/src')
-rw-r--r--addons/bus/static/src/js/bus.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/bus/static/src/js/bus.js b/addons/bus/static/src/js/bus.js
index b0756132012..3c828668308 100644
--- a/addons/bus/static/src/js/bus.js
+++ b/addons/bus/static/src/js/bus.js
@@ -9,12 +9,21 @@ bus.ERROR_DELAY = 10000;
bus.Bus = Widget.extend({
init: function(){
+ var self = this;
this._super();
this.options = {};
this.activated = false;
this.channels = [];
this.last = 0;
this.stop = false;
+
+ // bus presence
+ this.set("window_focus", true);
+ this.on("change:window_focus", self, function(e) {
+ self.options.im_presence = self.get("window_focus");
+ });
+ $(window).on("focus", _.bind(this.window_focus, this));
+ $(window).on("blur", _.bind(this.window_blur, this));
},
start_polling: function(){
if(!this.activated){
@@ -57,6 +66,13 @@ bus.Bus = Widget.extend({
delete_channel: function(channel){
this.channels = _.without(this.channels, channel);
},
+ // bus presence : window focus/unfocus
+ window_focus: function() {
+ this.set("window_focus", true);
+ },
+ window_blur: function() {
+ this.set("window_focus", false);
+ },
});
// singleton