Clear unread on focus iff convo is open
This commit is contained in:
parent
baa55c9018
commit
e0f84d9c8e
1 changed files with 7 additions and 3 deletions
|
@ -56,12 +56,16 @@
|
||||||
var onResize = this.forceUpdateMessageFieldSize.bind(this);
|
var onResize = this.forceUpdateMessageFieldSize.bind(this);
|
||||||
this.appWindow.contentWindow.addEventListener('resize', onResize);
|
this.appWindow.contentWindow.addEventListener('resize', onResize);
|
||||||
|
|
||||||
var onfocus = this.markRead.bind(this);
|
var onFocus = function() {
|
||||||
this.appWindow.contentWindow.addEventListener('focus', onfocus);
|
if (this.$el.css('display') !== 'none') {
|
||||||
|
this.markRead();
|
||||||
|
}
|
||||||
|
}.bind(this);
|
||||||
|
this.appWindow.contentWindow.addEventListener('focus', onFocus);
|
||||||
|
|
||||||
this.appWindow.onClosed.addListener(function () {
|
this.appWindow.onClosed.addListener(function () {
|
||||||
this.appWindow.contentWindow.removeEventListener('resize', onResize);
|
this.appWindow.contentWindow.removeEventListener('resize', onResize);
|
||||||
this.appWindow.contentWindow.removeEventListener('focus', onfocus);
|
this.appWindow.contentWindow.removeEventListener('focus', onFocus);
|
||||||
window.autosize.destroy(this.$messageField);
|
window.autosize.destroy(this.$messageField);
|
||||||
this.remove();
|
this.remove();
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
Loading…
Add table
Reference in a new issue