function getMusicName() {
db()
.then(function(connection) {
var sql = 'select name from musicInfo';
return queryMusicInfo(connection,sql);
},fail)
.then(function(result){
console.log(result)
})
}
因为then中很多函数都是异步的。
db queryMusicInfo是两不同的promise。
有没有什么办法在getMusicName这个函数中获取最后这个then返回的结果呢?还是promise有没有什么机制能够解决这种问题呢? 因为我想通过getMusicName把数据返回回去,想了很久但是没什么办法实现。