https://github.com/prayerslayer/elm-js-promises
Elm Flickr Example with JS Promises
https://github.com/prayerslayer/elm-js-promises
Last synced: 4 months ago
JSON representation
Elm Flickr Example with JS Promises
- Host: GitHub
- URL: https://github.com/prayerslayer/elm-js-promises
- Owner: prayerslayer
- Created: 2012-11-04T17:39:49.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2012-12-22T19:11:18.000Z (about 13 years ago)
- Last Synced: 2024-04-15T02:57:47.851Z (over 1 year ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elm Flickr Example w/ JS Promises
The Flickr Example from the blogpost [Escape from Callback Hell](http://elm-lang.org/learn/Escape-from-Callback-Hell.elm) in Javascript with Promises, resulting in prettier code.
~~~ javascript
var deferred_photos = requestTag( tag );
var deferred_photo = requestOneFrom( deferred_photos );
drawOnScreen( deferred_photo );
~~~
However, Elm is still more reusable due to implicit dependencies of JS Code. For example `requestOneFrom`:
1. Expects jQuery Deferred Object as input,
2. expects that input will be resolved some time,
3. expects that after resolving, input will return photos fetched from Flickr.