HarmonyOS 鸿蒙Next 有哪些应用场景需要使用axios或TaskPool向服务端发送多并发请求?
HarmonyOS 鸿蒙Next 有哪些应用场景需要使用axios或TaskPool向服务端发送多并发请求?
const getUserAccount = ():Promise<AxiosResponse> => {
return axios.get<string, AxiosResponse<string>, null>('/user/12345');
}
const getUserPermissions = ():Promise<AxiosResponse> => {
return axios.get<string, AxiosResponse<string>, null>('/user/12345/permissions');
}
Promise.all<AxiosResponse>([getUserAccount(), getUserPermissions()])
.then((results:AxiosResponse[]) => {
const acct = results[0].data as string;
const perm = results[1].data as string;
});
使用taskpool发起请求:developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-taskpool-V5
更多关于HarmonyOS 鸿蒙Next 有哪些应用场景需要使用axios或TaskPool向服务端发送多并发请求?的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
1 回复