Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Cancellable deferreds
var deferredsByPromise = new WeakMap();
recordRetriever.retrieveAsync = function (query) {
var deferred = Q.defer();
server.doPagedRetrieveWithCallback(query, 0, function (err, result) {
// wire up deferred.resolve and deferred.reject.
// recurse appropriately, increasing pagination,
// UNLESS deferred.isCancelled.
});
deferredsByPromise.set(deferred.promise, deferred);
return deferred.promise;
};
recordRetriever.cancel = function (promise) {
var deferred = deferredsByPromise.get(promise);
deferred.cancel();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.