Skip to content

Instantly share code, notes, and snippets.

@jonathanhudak
Created July 17, 2015 01:12
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 jonathanhudak/cac5c174affe4b88e9ec to your computer and use it in GitHub Desktop.
Save jonathanhudak/cac5c174affe4b88e9ec to your computer and use it in GitHub Desktop.
Q = require 'q'
_ = require 'lodash'
delay = (ms) ->
deferred = Q.defer()
setTimeout deferred.resolve, ms
return deferred.promise
App =
nums: []
init: ->
@start(@end)
start: (cb) ->
console.log 'start'
_this = @
Q.all([1...99].map((num) =>
delay @nums.push(num), 150
)).then =>
cb(_this)
end: (self) ->
console.log 'end', self.nums
App.init()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment