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