lib/suricate/generator/assets/javascript/widgets/widget.js in suricate-0.0.2 vs lib/suricate/generator/assets/javascript/widgets/widget.js in suricate-0.0.3
- old
+ new
@@ -30,16 +30,31 @@
Suricate.Widget.prototype.update = function(now) {
var self = this;
this.updater.update(now, function(data) {
self.view.setLastUpdateAt(now);
+ self.updateStatus(data.status);
self.setData(data);
});
};
/*
* Private
*/
+
+ Suricate.Widget.prototype.updateStatus = function(status) {
+ switch (status) {
+ case "ok":
+ this.view.setStatusOK();
+ break;
+ case "alert":
+ this.view.setStatusAlert();
+ break;
+ case "warning":
+ this.view.setStatusWarning();
+ break;
+ }
+ };
Suricate.Widget.prototype.setData = function(data) {
console.error("function setData(data) is not defined in Suricate.Widget's subclass", this);
};
}());