2 Editor.MessageCenter = Editor.Object.extend({
5 this.flashMessages = [];
6 this.firstFlashMessage = null;
9 addMessage: function(type, text, flash) {
10 this.messages.push({type: type, text: text});
12 this.flashMessages.push({type: type, text: flash});
13 if (this.flashMessages.length == 1) {
14 this.set('firstFlashMessage', this.flashMessages[0]);
15 setTimeout(this.changeFlashMessage.bind(this), 1000 * 10);
20 changeFlashMessage: function() {
21 this.flashMessages.splice(0, 1);
22 if (this.flashMessages.length > 0) {
23 this.set('firstFlashMessage', this.flashMessages[0]);
24 setTimeout(this.changeFlashMessage.bind(this), 1000 * 10);
26 this.set('firstFlashMessage', null);
33 var messageCenter = new Editor.MessageCenter();