Created
December 6, 2015 01:02
-
-
Save anthgur/2cddf81e04ea78f372c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def views | |
{:some-view SomeView | |
:another-view AnotherView}) | |
(def factories | |
(map om/factory (vals views))) | |
(defui Router | |
static om/Ident | |
(ident [this {:keys [route]}] | |
[route]) | |
static om/IQuery | |
(query [this] | |
[:route | |
(zipmap | |
(keys views) | |
(map om/get-query (vals views)))]) | |
Object | |
(render [this] | |
(let [props (om/props this) | |
{:keys [route]} props | |
view (route factories)] | |
(view props)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment