public/javascripts/components/notification.js in riojs-0.0.1 vs public/javascripts/components/notification.js in riojs-0.0.2
- old
+ new
@@ -37,13 +37,16 @@
this.html().fade();
}
},
classMethods: {
- notifications: [],
+ notifications: function() {
+ if (!this._notifications) { this._notifications = []; }
+ return this._notifications;
+ },
show: function(notification) {
- this.notifications.push(notification);
+ this.notifications().push(notification);
var html = notification.html();
Element.body().insert(html);
@@ -59,17 +62,17 @@
notification.hide.bind(notification).delay(notification.getDuration());
},
slideDownBy: function(pixels) {
- this.notifications.each(function(notification) {
+ this.notifications().each(function(notification) {
var html = notification.html();
new Effect.Move(html, {
y: pixels,
afterFinish: function() {
- this.notifications.splice(this.notifications.indexOf(notification));
- }
+ this.notifications().splice(this.notifications().indexOf(notification));
+ }.bind(this)
});
- });
+ }.bind(this));
}
}
});
\ No newline at end of file