Created
June 30, 2015 23:05
-
-
Save anonymous/01326f1bdf8129c25bff 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
update = Action.caseOn do | |
NextColor: (tile, model) -> | |
idx = find-index (is tile), model.tiles | |
flip(evolve) model, tiles: adjust (evolve background-color: cycle-colors), idx | |
InfiniScroll: (model) -> | |
evolve tiles: (concat _, model.load-more!), model | |
# Generate more tiles when resizing to a bigger window | |
Resize: (model) -> | |
max = pics-n$! | |
new-tiles = switch | |
| model.tiles.length < max => take max, model.tiles ++ model.load-more! | |
| otherwise => model.tiles | |
assoc \tiles, new-tiles, model | |
ChangePage: (page, params, model) -> | |
merge model, switch page | |
| \random | |
load-more = -> get-random-data pics-n$! | |
load-more : load-more | |
tiles : load-more! | |
| \user | |
request-user params.user, params.tld | |
tiles: [] | |
| \root | |
request-whoami! | |
tiles: [] | |
Update: (flip merge) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment