Created
January 22, 2017 21:53
-
-
Save anonymous/59df078b34ce3b58969b16c647466583 to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ # Counter ## State ``` commit [#state count: 0] commit @browser [#button sort: 0, text: "-", diff: -1] [#button sort: 1, text: "+", diff: 1] ``` ## Render ``` search [#state count] bind @browser [#div sort: 10 text: count] ``` ## Event ``` search @session @event @browser element = [#button diff] [#click #direct-target element: element] state = [#state count] commit @session @browser state.count := state.count + diff [#div text: "{{element.diff}} {{state.count}}"] ``` ## Styles ```css button { display: inline-block; width: 22px; color: green; } button[diff='-1'] { color: red; } ```