Skip to content

Instantly share code, notes, and snippets.

@anthgur
Created December 6, 2015 01:02
Show Gist options
  • Save anthgur/2cddf81e04ea78f372c6 to your computer and use it in GitHub Desktop.
Save anthgur/2cddf81e04ea78f372c6 to your computer and use it in GitHub Desktop.
(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