Sha256: 386e51d6f1f057f3ceb7fee28dea3dfe7f5a1806730138913280ad192ee25f92
Contents?: true
Size: 1.68 KB
Versions: 2
Compression:
Stored size: 1.68 KB
Contents
(function() { "use strict"; window.Suricate = window.Suricate || {}; Suricate.Widget = function(id, container, configuration, application) { this.id = id; this.container = container; this.application = application; this.configuration = configuration; }; /* * Public */ Suricate.Widget.prototype.getID = function() { return this.id; }; Suricate.Widget.prototype.getApplication = function() { return this.application; }; Suricate.Widget.prototype.init = function() { this.updater = new Suricate.WidgetUpdater(this, this.configuration.interval); this.view = new Suricate.WidgetView(this.configuration.template); this.view.setPlaceholders(this.configuration.placeholders); this.view.appendTo(this.container); }; 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); }; }());
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
suricate-0.0.4 | lib/suricate/generator/assets/javascript/widgets/widget.js |
suricate-0.0.3 | lib/suricate/generator/assets/javascript/widgets/widget.js |