【发布时间】:2019-05-23 17:41:30
【问题描述】:
在继续我的功能之前,我需要等待 localStorage 检索一个值...我读到我必须使用“async/await”指令,但我发现的示例都没有真正有效。
我的代码是
_ajustes.EsPrimeraVez().then (async (promAjuste)=> {
await console.log('TEST! en el then');
});
console.log('TEST! Post');
在“调整”内部:
public EsPrimeraVez() {
console.log('TEST! entrando en primeravez');
return this.storage.get('primeravez');
但它不会等待结果继续......这可能吗? 谢谢大家,新年快乐!
【问题讨论】:
标签: ionic-framework async-await local-storage