1, async function returns a target Promise
2, await is asynchronous wait, should be followed by a Promise objects Promise objects if not, it will be turned into an immediate resolve of Promise
3, await a waiting Promise is an object, the value of resolve Promise state will return the object, instead of returning the object Promise
onLoad: async function (options) { const aa = await this.promise1() //没有await console.log(aa) }, promise1(){ return new Promise((resolve, reject) => { resolve('aaaa') }) },
Promise output target
Promise {<resolved>: "aaaa"}
onLoad: async function (options) { const aa = await this.promise1() //有await console.log(aa) }, promise1(){ return new Promise((resolve, reject) => { resolve('aaaa') }) },
Promise resolve the target value of the output
yyyy