-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
I find callbacks become unwieldy when more than a couple are nested, so I'd be tempted to wrap methods in promises. e.g.
function whoAmIWithPromises() {
var d = $.Deferred();
Ipseorama.whoAmI(function(myfingerprint) {
d.resolve(myfingerprint);
}, function(err) {
d.reject(err);
});
return d.promise();
}
With the equivalent calling code reading:
whoAmIWithPromises().done(function(myfingerprint) {
gotFinger(myfingerprint);
}).fail(function(errorCase) {
console.log("could not create identity " + errorCase);
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels