Figuring out JS Promises has always been a challenge for me. I'm aware this might be a basic question, but please bear with me. =) Looking at the code snippet below, my goal is to modify a property within the class containing this function (essentially, I want to reference "this" within the fulfillment methods and have it point back to the class.
I came across suggestions related to setting context, however, they involved closures (()=>{...code..}) which aren't fully compatible with Internet Explorer. Despite our grievances towards that browser, we have to ensure this code functions correctly on IE.
So today, my query is how can I pass a reference to this into the following methods?
var result = this.saveChanges();
return Promise.resolve(result).then(function (value) {
return value.HasError === false;
}, function (value) {
if (value && value.responseJSON) {
return value.responseJSON.HasError === false;
}
return false;
});
Your invaluable assistance would be greatly appreciated.