Drastically simplify IoT TV

This commit is contained in:
Tony Garnock-Jones 2016-05-08 12:20:08 -04:00
parent a428423ff2
commit 6591091bb6
2 changed files with 3 additions and 22 deletions

View File

@ -19,7 +19,7 @@
<section>
<h3>TV</h3>
<div id="tv-container">
&nbsp;<div id="tv"></div>
&nbsp;<div><ul id="tv" class="alerts"></ul></div>
</div>
</section>

View File

@ -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]));
}
}
}