Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Another example combining JDeferred with Groovy
import org.jdeferred.*
import org.jdeferred.impl.*
def d = new DeferredObject()
def p = d.promise()
// gotta be explicit and can't use Groovy closures:
// DoneCallback / DoneFilter / DonePite are ambiguous
// in terms of signature, for SAM type coercion
def filtered = p.then(new DoneFilter<Integer, Integer>() {
Integer filterDone(Integer result) {
result * 10
}).done { result ->
// result would be original * 10
assert result == 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment