Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Single Page Webapps in ClojureScript with Pedestal

Single Page Webapps in ClojureScript with Pedestal

Including a Clojure Cup status report.
Presented at ClojuTRE 2013, August 28 at Tampere, Finland.

Tero Parviainen

August 28, 2013
Tweet

More Decks by Tero Parviainen

Other Decks in Technology

Transcript

  1. @abedra @amitrathore @marick @cemerick @ibdknox @chrishouser @cgrand @lisperati @swannodette @deanwampler

    @garybernhardt @hlship @weavejester @w01fe @antiheroine @nrrrdcore @lynaghk @michaelklishin @bmf @nathanmarz @neal4d @usabilitycounts@technomancy @samaaron @venkat_s
  2. Help Needed • Monitoring, IRC ops, contestant support during the

    competition. • May not participate in compo • Ping me at [email protected]
  3. The Hook (ns hello-world (:require [domina :as dom])) (def application-state

    (atom 0)) (defn render [old-state new-state] (dom/destroy-children! (dom/by-id "content")) (dom/append! (dom/by-id "content") (str "<h1>" new-state " Hello Worlds</h1>"))) (add-watch application-state :app-watcher (fn [key reference old-state new-state] (render old-state new-state))) (defn receive-input [] (swap! application-state inc) (.setTimeout js/window #(receive-input) 3000)) (defn ^:export main [] (receive-input))
  4. Three Models Google http://domain.com Web Page Title DERP ERP Human

    Resources 90% Process Compliance 300Hz Big Data Synergy 20 clouds Data Model Application Model DOM
  5. Application Model [:node-create [] :map] [:node-create [:main] :map] [:node-create [:main

    :todos] :map] [:value [:main :todos] nil ["one" "two" "three"]] [:node-create [:main :todo-count] :map] [:value [:main :todo-count] nil 3] Deltas
  6. Verbs over Nouns Data Model Messages User actions HTTP responses

    SSEs WebSocket input Timer events Transforms Transforms
  7. Verbs over Nouns DOM Application Model Render Google http://domain.com Web

    Page Title DERP ERP Human Resources 90% Process Compliance 300Hz Big Data Synergy 20 clouds
  8. Models from Processes Data Model Messages User actions HTTP responses

    SSEs WebSocket input Timer events Transforms Transforms Pure functions
  9. Messages from Events Data Model Messages User actions HTTP responses

    SSEs WebSocket input Timer events Transforms Transforms Simulated Simulated Simulated Simulated Simulated
  10. App Model From DOM Data UI Application Model Render Google

    http://domain.com Web Page Title :metrics :human-resources :compliance :big-data-synergy Automated {:amt 90 :unit “%”} {:amt 300 :unit “Hz”} {:amt 20 :unit “Clouds”}
  11. Dispatch from Execution Messages Transforms Data Flow Data Model Application

    Model Rendering DOM Input Queue App Model Queue Foreground Background Web Worker