我有以下代码:
if (!project) {
let pk_map = this.backend.get_pk_map ()
let pk = false
if (pk_map.hasOwnProperty (path)) {
pk = pk_map[path]
}
const _this = this
if (!pk) {
_this.network.getPackages (false , function (data){
//here i want to block as I need pk for next call
// I cant do project = this.network.getProject(data.pk) here
// as I have further code too
pk = data.pk
})
}
project = this.network.getProject(pk) // Need the Pk here
}
我想在_this.network.getPackages
阻止异步调用。我怎么能这样做?