我有一个承诺的功能:
myfunction() {
return new Promise(function(resolve) {
try {
console.log(`In Progress...`);
}
catch(err) {
console.log(`There was an error: ${err}`);
}
finally {
resolve(`Finished`);
return 'Finished';
}
});
}
myfunction().this.getMemory().then(values => {
return values;
});
它不断返回[object Object]
我没有得到什么返回值?
答案 0 :(得分:1)
您可以像我不知道有关getMemory函数那样调用
myfunction() {
return new Promise(function(resolve) {
try {
console.log(`In Progress...`);
}
catch(err) {
console.log(`There was an error: ${err}`);
}
finally {
resolve(`Finished`);
return 'Finished';
}
});
}
return myfunction().then(values => {
return this.getMemory().then(result=>{
return values;
}).catch(error=>{})
});