Registers catch callback, equivalent to then(null, ErrorCallback)
Registers callback to be called at end. Equivalent to then(onFinally, onFinally)
Resolves promise and calles then onError callback
Resolves promise and calles then onResolve callbacks
Resolves promise and calles then onResolve callbacks
Registers on resolve functions (set null for no callback)
HTTPRequest prom = new Promise!(string, HTTPStatusException)(); prom.then(delegate void(string s) { writeln(s); }).then(null, delegate void(HTTPStatusException e) { writeln("Error ", e.status, ": ", e.msg); }).except(delegate void(HTTPStatusException e) { writeln(e.msg); }).finish(delegate void() { writeln("Finished after error"); }); prom.resolve("My data"); prom.refresh(); prom.reject(new HTTPStatusException(451, "Reject message"));
Simple implementation of JavaScript promises