angular - 有角度的 httpClient 请求持续了多长时间?
问题描述
有没有办法知道有角度的 HttpClient 请求需要多长时间才能执行?
解决方案
public myRequest(): Observable<any>{
const startTime = performance.now();
return http.post<any>(url).pipe(
tap(x => {
const endTime = performance.now();
console.log(`Took ${endTime - startTime} to complete.`);
})
)
}
推荐阅读
- tfs - 'Checkout for edit' 如何在 TFS 中工作
- javascript - 如何获取代码以仅显示当前用户上传的图像?Ps 编程新手
- python-3.x - 为什么我的视频爬虫无法检测到简单的视频 src?
- spring - 除非调用 cachemanager.getCacheNames() 否则无法从 cachemanager 获取缓存
- php - 'fetch' 调用返回为未定义?
- jenkins - 在 Linux CentOS 上尝试使用 xvfb 和非 xvfb 运行无头 Chrome Protractor 测试时找不到 Angular 错误
- python - 如何计算python中二进制变量之间的相关性?
- elasticsearch - 定义了一个edgeNGram,搜索只对完整的单词起作用,而不是tokens
- graphql - 如何在没有 GraphQL 模式语言的情况下定义上传标量?
- vba - VBA at Access - 使用多个条件进行过滤,其中一个条件可以为 Null