Skip to content

Instantly share code, notes, and snippets.

@falsecz
Created June 19, 2014 08:43
Show Gist options
  • Save falsecz/10e246a03ed25d1a344c to your computer and use it in GitHub Desktop.
Save falsecz/10e246a03ed25d1a344c to your computer and use it in GitHub Desktop.
memoize = require 'memoizee'
endpoint = (done) ->
console.log "remote call"
setTimeout () ->
console.log "volam done"
done "vysledek"
, 1000
endpoint (x) ->
console.log "1 done", x
endpoint (x) ->
console.log "2 done", x
setTimeout () ->
console.log "========================="
endpointSPamatovackem = memoize endpoint, async: yes
endpointSPamatovackem (x) ->
console.log "1 done", x
endpointSPamatovackem (x) ->
console.log "2 done", x
, 2100
@falsecz
Copy link
Author

falsecz commented Jun 19, 2014

remote call
remote call
volam done
1 done vysledek
volam done
2 done vysledek
=========================
remote call
volam done
1 done vysledek
2 done vysledek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment