Debounce show
similarly to other methods
This commit is contained in:
parent
71be72b50c
commit
7807b19905
@ -258,6 +258,9 @@
|
|||||||
initialize () {
|
initialize () {
|
||||||
this.scrollDown = _.debounce(this._scrollDown, 250);
|
this.scrollDown = _.debounce(this._scrollDown, 250);
|
||||||
this.markScrolled = _.debounce(this._markScrolled, 100);
|
this.markScrolled = _.debounce(this._markScrolled, 100);
|
||||||
|
this.show = _.debounce(this._show, 250, {'leading': true});
|
||||||
|
|
||||||
|
|
||||||
this.createEmojiPicker();
|
this.createEmojiPicker();
|
||||||
this.model.messages.on('add', this.onMessageAdded, this);
|
this.model.messages.on('add', this.onMessageAdded, this);
|
||||||
this.model.messages.on('rendered', this.scrollDown, this);
|
this.model.messages.on('rendered', this.scrollDown, this);
|
||||||
@ -1009,18 +1012,6 @@
|
|||||||
u.fadeIn(this.el, _.bind(this.afterShown, this));
|
u.fadeIn(this.el, _.bind(this.afterShown, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
show () {
|
|
||||||
if (_.isUndefined(this.debouncedShow)) {
|
|
||||||
/* We wrap the method in a debouncer and set it on the
|
|
||||||
* instance, so that we have it debounced per instance.
|
|
||||||
* Debouncing it on the class-level is too broad.
|
|
||||||
*/
|
|
||||||
this.debouncedShow = _.debounce(this._show, 250, {'leading': true});
|
|
||||||
}
|
|
||||||
this.debouncedShow.apply(this, arguments);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
showNewMessagesIndicator () {
|
showNewMessagesIndicator () {
|
||||||
u.showElement(this.el.querySelector('.new-msgs-indicator'));
|
u.showElement(this.el.querySelector('.new-msgs-indicator'));
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user