Skip to content

Commit

Permalink
Merge pull request #56 from Quamolit/upgrade-caches
Browse files Browse the repository at this point in the history
upgrade caches
  • Loading branch information
soyaine authored Jul 6, 2020
2 parents dc35498 + 3e139b4 commit a9b41ce
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 37 deletions.
17 changes: 17 additions & 0 deletions calcit.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -14441,6 +14441,7 @@
|xD $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1593275725956)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1593275731589) (:text |caches/new-loop!) (:id |NgN02q2Oxpleaf)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1594053559911) (:text |*phlox-caches) (:id |uDZT3Bu5b)
:id |NgN02q2Oxp
|create-list $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1574007042676) (:id |nWVaCh-llR)
:data $ {}
Expand Down Expand Up @@ -14496,6 +14497,19 @@
:id |DrxjdjSjX_
:id |XDq0U9Qld5
:id |lXCEoU8Dr
|*phlox-caches $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1594053560743)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1594053563004) (:text |defonce) (:id |yc5Cvt82eM)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1594053560743) (:text |*phlox-caches) (:id |OFy6hKUNxC)
|r $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1594053560743)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1594053569724) (:text |caches/new-caches) (:id |9I5kxxbnse)
|j $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1594053571185)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1594053571580) (:text |{}) (:id |ZnEM2IFRc)
:id |2NB8_Iu1s
:id |6ogSHXW7fd
:id |CWjDbfwEtz
|graphics $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1581848614669)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1581848614669) (:text |defn) (:id |iXxESr_cR)
Expand Down Expand Up @@ -14619,6 +14633,7 @@
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1593275219139) (:text |caches/access-cache) (:id |qpX2q_oCTV)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1593275219139) (:text |xs) (:id |OdZyiA6lgY)
|b $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1594053605982) (:text |*phlox-caches) (:id |hfIReUERg)
:id |kpdFGKyPCm
:id |vXiCkebqzW
:id |CRp1zZL3cX
Expand Down Expand Up @@ -14652,6 +14667,7 @@
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1593275243624) (:text |caches/write-cache!) (:id |X2kr2tP03jleaf)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1593275244426) (:text |xs) (:id |edcG2M-tQ)
|r $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1593275246010) (:text |result) (:id |lMYC6lh9N0)
|b $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1594053611371) (:text |*phlox-caches) (:id |j_6oomrsnL)
:id |X2kr2tP03j
|v $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1593275248228) (:text |result) (:id |IR9QlT_O77)
:id |n__edt2L4X
Expand Down Expand Up @@ -15171,6 +15187,7 @@
|v $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1593275674959)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1593275681998) (:text |caches/reset-caches!) (:id |X2eSmCJQKHleaf)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1594053590861) (:text |*phlox-caches) (:id |xLD9-eOoTo)
:id |X2eSmCJQKH
:id |745HP2k3CO
:proc $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1573320460236) (:id |-i3bb3QehB) (:data $ {})
Expand Down
8 changes: 4 additions & 4 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
:paths ["src" "macros"]
:deps {
mvc-works/lilac {:mvn/version "0.1.5"}
respo/ui {:mvn/version "0.3.14"}
respo {:mvn/version "0.12.1"}
cumulo/caches {:mvn/version "0.0.1"}
mvc-works/lilac {:mvn/version "0.1.6"}
respo/ui {:mvn/version "0.3.15"}
respo {:mvn/version "0.12.3"}
cumulo/caches {:mvn/version "0.1.0"}
}
:aliases {
:release {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "jiyinyiyong",
"license": "MIT",
"devDependencies": {
"shadow-cljs": "^2.10.13"
"shadow-cljs": "^2.10.14"
},
"dependencies": {
"fontfaceobserver": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion release.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:version "0.3.3",
{:version "0.3.4-a1",
:group-id "quamolit",
:artifact-id "phlox",
:skip-tag true,
Expand Down
4 changes: 2 additions & 2 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
:cache-blockers #{cumulo-util.build}
:dependencies [
[mvc-works/hsl "0.1.2"]
[mvc-works/shell-page "0.1.14"]
[mvc-works/shell-page "0.1.15"]
[cumulo/util "0.1.12"]
[respo "0.12.3"]
[respo/ui "0.3.15"]
[cumulo/caches "0.0.1"]
[cumulo/caches "0.1.0"]
[org.clojure/core.incubator "0.1.4"]
[mvc-works/lilac "0.1.6"]
]
Expand Down
12 changes: 8 additions & 4 deletions src/phlox/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

(defonce *events-element (atom nil))

(defonce *phlox-caches (caches/new-caches {}))

(defonce *renderer (atom nil))

(defonce *tree-element (atom nil))
Expand All @@ -48,8 +50,10 @@
(defn call-comp-helper [f params]
(if (or (some fn? params))
(apply f params)
(let [xs (concat [f] params), v (caches/access-cache xs)]
(if (some? v) v (let [result (apply f params)] (caches/write-cache! xs result) result)))))
(let [xs (concat [f] params), v (caches/access-cache *phlox-caches xs)]
(if (some? v)
v
(let [result (apply f params)] (caches/write-cache! *phlox-caches xs result) result)))))

(defn create-element [tag props children]
{:name tag,
Expand All @@ -61,7 +65,7 @@
(dev-check props lilac-circle)
(create-element :circle props children))

(defn clear-phlox-caches! [] (caches/reset-caches!))
(defn clear-phlox-caches! [] (caches/reset-caches! *phlox-caches))

(defn container [props & children]
(dev-check props lilac-container)
Expand Down Expand Up @@ -161,7 +165,7 @@
(handle-keyboard-events *tree-element wrap-dispatch))
(rerender-app! expanded-app wrap-dispatch options))
(reset! *tree-element expanded-app))
(caches/new-loop!))
(caches/new-loop! *phlox-caches))

(defn text [props & children]
(dev-check props lilac-text)
Expand Down
50 changes: 25 additions & 25 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9b41ce

Please sign in to comment.