Drastically simplify IoT TV
This commit is contained in:
parent
a428423ff2
commit
6591091bb6
|
@ -19,7 +19,7 @@
|
|||
<section>
|
||||
<h3>TV</h3>
|
||||
<div id="tv-container">
|
||||
<div id="tv"></div>
|
||||
<div><ul id="tv" class="alerts"></ul></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -14,28 +14,9 @@ var jQueryEvent = Syndicate.JQuery.jQueryEvent;
|
|||
|
||||
function spawnTV() {
|
||||
actor {
|
||||
this.alerts = [];
|
||||
this.alertFragment = ["ul"];
|
||||
|
||||
this.computeDisplay = function () {
|
||||
var self = this; // omg javascript
|
||||
this.alertFragment = ["ul"];
|
||||
this.alerts.forEach(function (t) {
|
||||
self.alertFragment.push(["li", t]);
|
||||
});
|
||||
};
|
||||
|
||||
forever {
|
||||
assert DOM('#tv', 'alerts', Syndicate.seal(this.alertFragment));
|
||||
|
||||
on asserted tvAlert($text) {
|
||||
this.alerts.push(text);
|
||||
this.computeDisplay();
|
||||
}
|
||||
|
||||
on retracted tvAlert($text) {
|
||||
this.alerts = this.alerts.filter(function (t) { return t !== text; });
|
||||
this.computeDisplay();
|
||||
during tvAlert($text) {
|
||||
assert DOM('#tv', 'alert', Syndicate.seal(["li", text]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue