Skip to content

Instantly share code, notes, and snippets.

@nubunto
Created March 25, 2015 14:12
Show Gist options
  • Save nubunto/bb995b9232dbea9ff8ed to your computer and use it in GitHub Desktop.
Save nubunto/bb995b9232dbea9ff8ed to your computer and use it in GitHub Desktop.
mithril's first page example ported to sibilant
(var app {})
(def app.page-list () (m.request {method 'GET url 'pages.json}))
(def app.controller ()
(var pages (app.page-list))
{pages pages rotate (#() (pages.push (pages.shift)))})
(def app.view (ctrl)
[(ctrl.pages.map (#(page) (m "a" {href page.url} page.title))) (m "button" {onclick ctrl.rotate}, "rotate links")])
(m.module (document.getElementById "example") app)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment