Debounce updates to notifications and other events

Wait for one second of silence before displaying new notifications,
updating the unread count and conversation list previews.

Fixes #470
This commit is contained in:
lilia 2016-04-11 11:24:18 -07:00
parent ca28ba69d6
commit bb2868f1ec
3 changed files with 12 additions and 8 deletions

View file

@ -16,7 +16,8 @@
'click': 'select'
},
initialize: function() {
this.listenTo(this.model, 'change', this.render); // auto update
// auto update
this.listenTo(this.model, 'change', _.debounce(this.render.bind(this), 1000));
this.listenTo(this.model, 'destroy', this.remove); // auto update
this.listenTo(this.model, 'opened', this.markSelected); // auto update
extension.windows.onClosed(this.stopListening.bind(this));