falsecz
6/19/2014 - 8:43 AM

index.coffee

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