Skip to content

Latest commit

 

History

History
84 lines (55 loc) · 1.84 KB

README.md

File metadata and controls

84 lines (55 loc) · 1.84 KB

Reel: state management library for Respo

as a time traveling debugger. This is exprimental technology.

Built as actions-in-recorder.

Demo http://repo.respo-mvc.org/reel/

Usage

Clojars Project

[respo/reel "0.4.0"]

"shortid" from npm is on dependency list, make sure it's installed.

Browse src/reel/main.cljs to see how to use it.

Functions you need from namespaces:

[reel.util :refer [listen-devtools!]]
[reel.core :refer [reel-updater refresh-reel]]
[reel.schema :as reel-schema]

Notice that store now lives inside reel map.

Instead of *store, you need *reel for global states. For example:

(def store {:states {} :tasks (list)})

(defonce *reel
  (atom (-> reel-schema/reel
            (assoc :base store)
            (assoc :store store))))

And we need a reel-updater besides the familiar updater we used in Respo:

(defn dispatch! [op op-data]
  (let [new-reel (reel-updater updater @*reel op op-data)]
    (reset! *reel new-reel)))

Make sure you watch *reel and initialize reel.core/*code inside main! function:

(add-watch *reel :changes (fn [] (render-app! render!)))

Call handle-reload! with so many arguments to reload store and element caches:

(defn reload! []
  (clear-cache!)
  (reset! *reel (refresh-reel @*reel schema/store updater)))

To use records panel, please refer to comp-reel:

(comp-reel (>> states :reel) reel styles)

Listening to Command Shift a to launch DevTools:

(listen-devtools! "a" dispatch!)

Develop

Workflow https://github.com/mvc-works/calcit-workflow

License

MIT