mirror of
https://github.com/status-im/re-frame.git
synced 2025-02-23 23:38:11 +00:00
Rename default-value to default-db
This commit is contained in:
parent
a46592f37a
commit
292c8d8ea8
@ -43,9 +43,9 @@
|
|||||||
;; 2. `events.cljs` for the registration of :initialise-db handler
|
;; 2. `events.cljs` for the registration of :initialise-db handler
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(def default-value ;; what gets put into app-db by default.
|
(def default-db ;; what gets put into app-db by default.
|
||||||
{:todos (sorted-map) ;; an empty list of todos. Use the (int) :id as the key
|
{:todos (sorted-map) ;; an empty list of todos. Use the (int) :id as the key
|
||||||
:showing :all}) ;; show all todos
|
:showing :all}) ;; show all todos
|
||||||
|
|
||||||
|
|
||||||
;; -- Local Storage ----------------------------------------------------------
|
;; -- Local Storage ----------------------------------------------------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
(ns todomvc.events
|
(ns todomvc.events
|
||||||
(:require
|
(:require
|
||||||
[todomvc.db :refer [default-value todos->local-store]]
|
[todomvc.db :refer [default-db todos->local-store]]
|
||||||
[re-frame.core :refer [reg-event-db reg-event-fx inject-cofx path trim-v
|
[re-frame.core :refer [reg-event-db reg-event-fx inject-cofx path trim-v
|
||||||
after debug]]
|
after debug]]
|
||||||
[cljs.spec :as s]))
|
[cljs.spec :as s]))
|
||||||
@ -98,7 +98,7 @@
|
|||||||
|
|
||||||
;; the event handler (function) being registered
|
;; the event handler (function) being registered
|
||||||
(fn [{:keys [db local-store-todos]} _] ;; take 2 vals from coeffects. Ignore event vector itself.
|
(fn [{:keys [db local-store-todos]} _] ;; take 2 vals from coeffects. Ignore event vector itself.
|
||||||
{:db (assoc default-value :todos local-store-todos)})) ;; all hail the new state
|
{:db (assoc default-db :todos local-store-todos)})) ;; all hail the new state
|
||||||
|
|
||||||
|
|
||||||
;; usage: (dispatch [:set-showing :active])
|
;; usage: (dispatch [:set-showing :active])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user