使用Class将所有数据存储在对象中[重复]
这个问题在这里已有答案:
- Async/Await Class Constructor 13个答案
- Is it bad practice to have a constructor function return a Promise? 4个答案
你可以异步构造你的GetAllOptions
对象:
constructor (async_param) {
if (typeof async_param === 'undefined') {
throw new Error('Cannot be called directly');
}
}
static async build () {
var async_result = await getJobCategories()();
return new myClass(async_result);
}
与本文相关的文章
评论列表(0)
- 暂无评论