Update messenger instance if it was already created

Fixed: UI notifications don't bounce around when there is more than one
This commit is contained in:
Mark McDowall 2014-03-10 11:57:25 -07:00
parent c2087af8c9
commit 70266c921b
1 changed files with 7 additions and 3 deletions

View File

@ -7,12 +7,10 @@ define(
return Marionette.ItemView.extend({ return Marionette.ItemView.extend({
initialize: function () { initialize: function () {
this.listenTo(this.model, 'change', this.render); this.listenTo(this.model, 'change', this.render);
}, },
render: function () { render: function () {
if (!this.model.get('message') || !this.model.get('sendUpdatesToClient')) { if (!this.model.get('message') || !this.model.get('sendUpdatesToClient')) {
return; return;
@ -37,7 +35,13 @@ define(
message.hideAfter = 0; message.hideAfter = 0;
} }
Messenger.show(message); if (this.messenger) {
this.messenger.update(message);
}
else {
this.messenger = Messenger.show(message);
}
console.log(message.message); console.log(message.message);
} }