From 08b4b8569e09344f88d248ad01e2e1703031c7db Mon Sep 17 00:00:00 2001 From: Mike Thompson Date: Thu, 1 Sep 2016 13:12:19 +1000 Subject: [PATCH] Word fiddling --- docs/EffectfulHandlers.md | 20 ++++++++++---------- images/logo/README.md | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/EffectfulHandlers.md b/docs/EffectfulHandlers.md index 5fc2bd4..491c2cc 100644 --- a/docs/EffectfulHandlers.md +++ b/docs/EffectfulHandlers.md @@ -326,11 +326,11 @@ One of the keys in `cofx` will likely be `:db` and that will be the value of `ap Remember this impure handler from before: ```clj -(reg-event-db ;; a -db registration - :load-localstore - (fn [db _] ;; db first argument - (let [defaults (js->clj (.getItem js/localStorage "defaults-key"))] ;; <-- Eeek - (assoc db :defaults defaults)))) +(reg-event-db ;; a -db registration + :load-localstore + (fn [db _] ;; db first argument + (let [defaults (js->clj (.getItem js/localStorage "defaults-key"))] ;; <-- Eeek!! + (assoc db :defaults defaults)))) ``` It was impure because it obtained an input from other than its arguments. @@ -339,7 +339,7 @@ We'd now rewrite it as a pure handler, like this: (reg-event-fx ;; notice the -fx :load-localstore (fn [cofx _] ;; cofx is a map containing inputs - (let [defaults (:defaults-key cofx)] ;; <-- use it here + (let [defaults (:local-store cofx)] ;; <-- use it here {:db (assoc (:db cofx) :defaults defaults)}))) ;; returns effects map ``` @@ -355,10 +355,10 @@ data from arguments. `-db` handlers and `-fx` handlers are conceptually the same. They only differ numerically. -`-db` handlers take ONE coeffect called `db`, and they return only ONE effect (db again). +`-db` handlers take __one__ coeffect called `db`, and they return only __one__ effect (db again). -Whereas `-fx` handlers take potentially MANY coeffects (a map of them) and they return -potentially MANY effects (a map of them). So, One vs Many. +Whereas `-fx` handlers take potentially __many__ coeffects (a map of them) and they return +potentially __many__ effects (a map of them). So, One vs Many. Just to be clear, the following two handlers achieve the same thing: ```clj @@ -390,7 +390,7 @@ cause additional side-effects (effects). That's when you reach for `-fx` handle In the next tutorial, we'll shine a light on `interceptors` which are the mechanism by which event handlers are executed. That knowledge will give us a springboard -to then, as a next step, better understand coeffects and effects. We'll soon be writing our own. +to then, as a next step, better understand coeffects and effects. We'll soon be writing our own. --- Up: [Index](README.md)       diff --git a/images/logo/README.md b/images/logo/README.md index fff87ac..7229c6f 100644 --- a/images/logo/README.md +++ b/images/logo/README.md @@ -1,7 +1,8 @@ - ![logo](/images/logo/re-frame_256w.png?raw=true) +[The background story](/docs/The-re-frame-logo.md) + Created via [Sketch.app](https://www.sketchapp.com/). See the file `re-frame-logo.sketch` Unfortunately the gradients are not exported properly so we can't provide an SVG here for now.