Created
June 14, 2013 01:16
-
-
Save maxbeatty/5778738 to your computer and use it in GitHub Desktop.
dumb promises
This file contains hidden or 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
$.get "/path", (data) => | |
if data.length > 0 | |
items = [] | |
done = 0 | |
for d in data | |
done++ | |
require ["#{d.file}.html"], (tpl) -> | |
items.push | |
title: 'hmm' | |
partial: _.template tpl, d.tplData | |
done-- | |
setTimeout => | |
@render content: @wrapper items: items if done is 0 | |
, 50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How could I have used Promises given
require
may or may not have had to make a request for the file?