Skip to content

Instantly share code, notes, and snippets.

Created January 22, 2017 21:53
Show Gist options
  • Save anonymous/59df078b34ce3b58969b16c647466583 to your computer and use it in GitHub Desktop.
Save anonymous/59df078b34ce3b58969b16c647466583 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Jan 22, 2017.
    37 changes: 37 additions & 0 deletions examples-server.eve
    Original 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;
    }
    ```