Skip to content

Instantly share code, notes, and snippets.

@meeDamian
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meeDamian/10410531 to your computer and use it in GitHub Desktop.
Save meeDamian/10410531 to your computer and use it in GitHub Desktop.
t = new Transaction()
t.start()
class Order
start: (callback) ->
callback someDataFetchedFromInterwebs
class Transaction
@status = "created"
@orders = [
new Order()
new Order()
new Order()
]
start: ->
console.log "starting transaction!"
stupidName = (i=0) => @orders[i].start callback i
callback = (i) => (data) =>
console.log i, data
if @orders[ ++i ]?
@status = "order_" + i
stupidName i
else
@status = "done"
console.log "END"
console.log "RUN"
stupidName()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment