Start a new topic

Success callback - parameter or promise?

In the HTML5 guide the [Signup example](http://devcenter.kinvey.com/html5/guides/users#signuphttp:// "signup example") shows a success callback function passed into the options.



var promise = Kinvey.User.signup({

username : 'username',

password : 'password'

}, {

success: function(response) {

...

}

});



Why? The signup method returns a promise, isn't the whole point of promises to handle success and failure callbacks? What will happen to the promise if I provide the callback function too? Will it be eventually fulfilled?



Thanks
1 Comment

Good afternoon @daniel_sedlacek‌ ,



I think that the reason that this example was created this way to illustrate that you can use either a callback or the promise. Typically we don't recommend using both in your code as it would likely create some confusion when you'd go to maintain your code down the line.



Please let me know if you have any other questions,
Login or Signup to post a comment