standardize on initialization function naming

This commit is contained in:
Gered 2016-05-30 19:07:44 -04:00
parent 8b21d12167
commit e6ac826c24
7 changed files with 9 additions and 9 deletions

View file

@ -376,7 +376,7 @@
(defn ^:export run (defn ^:export run
[] []
(rdv/configure!) (rdv/init!)
(browserchannel/connect! {} {:middleware [rdv/middleware]}) (browserchannel/connect! {} {:middleware [rdv/middleware]})
(r/render-component [class-registry-app] (.getElementById js/document "app"))) (r/render-component [class-registry-app] (.getElementById js/document "app")))

View file

@ -189,7 +189,7 @@
(defn run-server (defn run-server
[] []
(rdv/init-views! view-system {:views views}) (rdv/init! view-system {:views views})
(immutant/run handler {:port 8080})) (immutant/run handler {:port 8080}))
(defn -main (defn -main

View file

@ -167,7 +167,7 @@
(defn ^:export run (defn ^:export run
[] []
; Configure reagent-data-views and then BrowserChannel. ; Configure reagent-data-views and then BrowserChannel.
(rdv/configure!) (rdv/init!)
; NOTE: We are passing in an empty map for the BrowserChannel event handlers only ; NOTE: We are passing in an empty map for the BrowserChannel event handlers only
; because this todo app is not using BrowserChannel for any purpose other ; because this todo app is not using BrowserChannel for any purpose other

View file

@ -177,7 +177,7 @@
; a drop-in replacement for views.core/init!. ; a drop-in replacement for views.core/init!.
; if you need to shutdown the views system (e.g. if you're using something like ; if you need to shutdown the views system (e.g. if you're using something like
; Component or Mount), you can just call views.core/shutdown!. ; Component or Mount), you can just call views.core/shutdown!.
(rdv/init-views! view-system {:views views}) (rdv/init! view-system {:views views})
(immutant/run handler {:port 8080})) (immutant/run handler {:port 8080}))

View file

@ -3,7 +3,7 @@
[net.thegeez.browserchannel.client :as browserchannel] [net.thegeez.browserchannel.client :as browserchannel]
[reagent-data-views.client.core :as client])) [reagent-data-views.client.core :as client]))
(defn configure! (defn init!
"performs initial configuration necessary to hook browserchannel into reagent-data-views "performs initial configuration necessary to hook browserchannel into reagent-data-views
as the client/server messaging backend. should be called once on page load before as the client/server messaging backend. should be called once on page load before
browserchannel is initialized." browserchannel is initialized."

View file

@ -12,7 +12,7 @@
(log/trace client-id "refresh view" view-sig) (log/trace client-id "refresh view" view-sig)
(browserchannel/send-data! client-id [:views/refresh [view-sig view-data]])) (browserchannel/send-data! client-id [:views/refresh [view-sig view-data]]))
(defn init-views! (defn init!
"initializes the views system and adds browserchannel-specific configuration "initializes the views system and adds browserchannel-specific configuration
to it to enable the necessary hooks into reagent-data-views. to it to enable the necessary hooks into reagent-data-views.
this function acts as a direct replacement to calling views.core/init!, so this function acts as a direct replacement to calling views.core/init!, so
@ -30,7 +30,7 @@
(views/init! view-system options) (views/init! view-system options)
(server/set-context-fn! view-system (:context-fn options)))) (server/set-context-fn! view-system (:context-fn options))))
([options] ([options]
(init-views! (atom {}) options))) (init! (atom {}) options)))
(defn ->middleware (defn ->middleware
"returns clj-browserchannel server-side event middleware for injecting "returns clj-browserchannel server-side event middleware for injecting

View file

@ -26,7 +26,7 @@
(on-close! view-system ev) (on-close! view-system ev)
(on-receive! view-system ev))) (on-receive! view-system ev)))
(defn init-views! (defn init!
([^Atom view-system sente-chsk-map options] ([^Atom view-system sente-chsk-map options]
(let [options (-> options (let [options (-> options
(assoc :send-fn #(views-send-fn sente-chsk-map %1 %2)))] (assoc :send-fn #(views-send-fn sente-chsk-map %1 %2)))]
@ -35,4 +35,4 @@
(views/init! view-system options) (views/init! view-system options)
(server/set-context-fn! view-system (:context-fn options)))) (server/set-context-fn! view-system (:context-fn options))))
([sente-chsk-map options] ([sente-chsk-map options]
(init-views! (atom {}) sente-chsk-map options))) (init! (atom {}) sente-chsk-map options)))