如果我用then(gAuth)构造替换下面的asynch / await,我对Google Auth Init的调用就可以了。目前,init()调用永远不会返回,浏览器会挂起。
我是否误解了等待"的要求?
async function gInit() {
// Check if already logged in with Google
try {
gAuth = await gapi.auth2.init({
client_id: providers.google.clientId
})
alert("sign in: " + gAuth.isSignedIn.get());
} catch (err) {
alert(err.message || err.text)
delete providers.google;
}
}