I Have an object (myObject). For this object I created a method (objectPromise) which returns a Promise
function myObject(){
this.number = 2;
this.objectPromise = function(data) {
return new Promise((resolve, reject) => {
if (data == this.number) {
resolve();
} else {
reject();
}
});
};
};
then I have this code 1)
obj = new myObject();
myPromise1
.then(obj.objectPromise)
.then(function(result){
})
.catch(function(err){
});
2)
obj = new myObject();
myPromise1
.then(function(result){
obj.objectPromise(result)
})
.then(function(result){
})
.catch(function(err){
});
I didn't understand why 1) doesn't call my Promise