If you are not familiar with promises, don’t bother with ES6’s async/await, you will be even more confused. If you are not familiar with promises, you can just use then as a callback (actually promises are quite easy to learn)
var value;
function cb(rs){
value = rs;
console.log(value);
}
function onerr(err){
console.error(err);
}
client.getMap(config.map).then(cb,onerr);
If you want to use promise, you have to use then/catch, or use async/await to directly convert asynchronous operations into synchronous operations.
async/await learning reference teacher Ruan Yifeng => http://es6.ruanyifeng.com/#do...
soonfy
If you are not familiar with promises, don’t bother with ES6’s async/await, you will be even more confused.
If you are not familiar with promises, you can just use then as a callback (actually promises are quite easy to learn)