Created
March 25, 2015 14:12
-
-
Save nubunto/bb995b9232dbea9ff8ed to your computer and use it in GitHub Desktop.
mithril's first page example ported to sibilant
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
(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