Skip to content

Commit eaec538

Browse files
committed
Merge pull request #6 from pupeno/patch-1
Add example for Silk
2 parents dc651cd + 616b81b commit eaec538

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,27 @@ pushy should work with any routing library:
7373
(pushy/start! history)
7474
```
7575

76+
[Silk](https://github.com/DomKM/silk)
77+
78+
```clojure
79+
(ns foo.core
80+
(:require [domkm.silk :as silk]
81+
[pushy.core :as pushy]))
82+
83+
(def state (atom {}))
84+
85+
(def app-routes
86+
(silk/routes [[:foo [["/foo"]]]]))
87+
88+
(defn set-page! [match]
89+
(swap! state assoc :page match))
90+
91+
(def history
92+
(pushy/pushy set-page! (partial silk/arrive app-routes)))
93+
94+
(pushy/start! history)
95+
```
96+
7697
### goog.history.HTML5History methods
7798

7899
You can set the history state manually by calling the `set-token!` method. This will call the `dispatch` fn on a successfully matched path.

0 commit comments

Comments
 (0)