Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

17 lines (10 sloc) 0.544 kb
console.log "This file demonstrates how Futures wait until they receive the results before they call the callback method given in @get(). \n"
AsyncFuture = require '../../src/async_future'
delay_function = (delay, done) ->
setTimeout((->
console.log 'The future receives the result.'
done('result')), delay)
console.log 'creating the future...'
future = new AsyncFuture delay_function, 2000
console.log 'requesting the result now'
future.get (result) -> console.log "The future calls the get method's callback with the result."
Jump to Line
Something went wrong with that request. Please try again.