Remove dead code (mostly unused requires)

This commit is contained in:
Nicholas Kariniemi 2015-06-16 20:03:32 +03:00
parent f7b79a5e2a
commit cc3dbdca62
6 changed files with 31 additions and 39 deletions

View file

@ -1,7 +1,6 @@
(ns grub.db
(:require [monger.core :as m]
[monger.collection :as mc]
[monger.operators :as mo]
[clojure.core.async :as a :refer [<! >! chan go]]))
(def collection "grub-lists")

View file

@ -1,15 +1,9 @@
(ns grub.websocket
(:require [grub.db :as db]
[org.httpkit.server :as httpkit]
(:require [org.httpkit.server :as httpkit]
[clojure.core.async :as a :refer [<! >! chan go]]
[cognitect.transit :as t])
(:import [java.io ByteArrayInputStream ByteArrayOutputStream]))
(defn disconnected [status ws-channel to from]
(println "Client disconnected:" (.toString ws-channel) "with status" status)
(a/close! to)
(a/close! from))
(defn write-msg [msg]
(let [out (ByteArrayOutputStream. 4096)
writer (t/writer out :json)]

View file

@ -23,8 +23,8 @@
>remote (chan)
events (chan)
view-state (view/render-app state/empty-state render-states new-states)
ws (websocket/connect pending-msg >remote events)
agent-states (sync/sync-client! >remote events new-states states)]
ws (websocket/connect pending-msg >remote events)]
(sync/sync-client! >remote events new-states states)
(add-watch states :render (fn [_ _ old new]
(when-not (= old new)
(a/put! render-states (state/get-latest new)))))

View file

@ -1,7 +1,7 @@
(ns grub.view.grub
(:require [grub.view.dom :as dom]
[om.core :as om :include-macros true]
[sablono.core :as html :refer-macros [html]]
[sablono.core :refer-macros [html]]
[cljs.core.async :as a :refer [<! put! chan]]
[cljs-uuid.core :as uuid])
(:require-macros [grub.macros :refer [log logs]]

View file

@ -2,7 +2,7 @@
(:require [grub.view.dom :as dom]
[grub.view.grub :as grub-view]
[om.core :as om :include-macros true]
[sablono.core :as html :refer-macros [html]]
[sablono.core :refer-macros [html]]
[cljs.core.async :as a :refer [<! chan]])
(:require-macros [grub.macros :refer [log logs]]
[cljs.core.async.macros :refer [go go-loop]]))
@ -32,33 +32,32 @@
:remove-grub-ch (chan)})
om/IRenderState
(render-state [this {:keys [new-grub-text remove-grub-ch] :as state}]
(let [add (om/get-shared owner :grub-add)]
(html
[:div
[:h3 "Grub List"]
[:div.input-group.add-grub-input-form
[:span.input-group-btn
[:input.form-control#add-grub-input
{:type "text"
:placeholder "What do you need?"
:value new-grub-text
:on-key-up #(when (dom/enter-pressed? %)
(html
[:div
[:h3 "Grub List"]
[:div.input-group.add-grub-input-form
[:span.input-group-btn
[:input.form-control#add-grub-input
{:type "text"
:placeholder "What do you need?"
:value new-grub-text
:on-key-up #(when (dom/enter-pressed? %)
(add-grub owner grubs new-grub-text))
:on-change #(om/set-state! owner :new-grub-text (dom/event-val %))}]]
[:button.btn.btn-primary
{:id "add-grub-btn"
:type "button"
:on-click #(add-grub owner grubs new-grub-text)}
[:span.glyphicon.glyphicon-plus#add-grub-btn]]]
[:ul#grub-list.list-group
(for [grub (sort-grubs grubs)]
(om/build grub-view/view grub {:key :id :opts {:remove-ch remove-grub-ch}}))]
[:button.btn.pull-right
{:id "clear-all-btn"
:class (when (empty? grubs) "hidden")
:type "button"
:on-click #(om/update! grubs nil {} :local)}
"Clear all"]])))
:on-change #(om/set-state! owner :new-grub-text (dom/event-val %))}]]
[:button.btn.btn-primary
{:id "add-grub-btn"
:type "button"
:on-click #(add-grub owner grubs new-grub-text)}
[:span.glyphicon.glyphicon-plus#add-grub-btn]]]
[:ul#grub-list.list-group
(for [grub (sort-grubs grubs)]
(om/build grub-view/view grub {:key :id :opts {:remove-ch remove-grub-ch}}))]
[:button.btn.pull-right
{:id "clear-all-btn"
:class (when (empty? grubs) "hidden")
:type "button"
:on-click #(om/update! grubs nil {} :local)}
"Clear all"]]))
om/IWillMount
(will-mount [_]
(let [add-grubs-ch (om/get-shared owner :add-grubs-ch)

View file

@ -3,7 +3,7 @@
[grub.view.grub :as grub-view]
[grub.util :as util]
[om.core :as om :include-macros true]
[sablono.core :as html :refer-macros [html]]
[sablono.core :refer-macros [html]]
[cljs.core.async :as a :refer [<! put! chan]]
[cljs-uuid.core :as uuid])
(:require-macros [grub.macros :refer [log logs]]