【问题标题】:Is there a polyfill for window.performance.getEntriesByType in Safari?Safari 中是否有用于 window.performance.getEntriesByType 的 polyfill?
【发布时间】:2017-02-16 14:28:12
【问题描述】:

看起来 window.performance.getEntrieswindow.performance.getEntriesByType 没有在 Safari 中定义。

这些功能是否有 polyfill?还是有人创造了另一种选择?

我想要做的是让页面中加载所有资源。 (所有图片、css和js文件)

【问题讨论】:

  • 很想知道所有跨浏览器性能API!是时候开始准确衡量我们的网站负载指标了。

标签: javascript safari mobile-safari polyfills


【解决方案1】:

由于 Safari 不以任何 JavaScript 方式提供该信息,因此不可能为此创建 Polyfill。 别再找了。你不会有运气的:(

PS.:这个答案要小心。 window.performance 上的一些功能可以用 polyfills 实现,但不是我要求的 2 个(这对于某些性能检查是必需的)

【讨论】:

  • 如果你是一名 Safari 开发者,我会否决你,但鉴于你只是给出了一个有用的警告,我认为它值得一票。 Safari 现在缺乏主要的网络标准..
【解决方案2】:

Safari 确实实现了 performance.timing; 指标是在纪元时间

> performance.timing
< PerformanceTiming = $2
connectEnd: 1588977207613
connectStart: 1588977207613
domComplete: 1588977208988
domContentLoadedEventEnd: 1588977208410
domContentLoadedEventStart: 1588977208390
domInteractive: 1588977208390
domLoading: 1588977207819
domainLookupEnd: 1588977207613
domainLookupStart: 1588977207613
fetchStart: 1588977207613
loadEventEnd: 1588977209012
loadEventStart: 1588977209012
navigationStart: 1588977207613
redirectEnd: 0
redirectStart: 0
requestStart: 1588977207685
responseEnd: 1588977207826
responseStart: 1588977207804
secureConnectionStart: 0
unloadEventEnd: 0
unloadEventStart: 0
PerformanceTiming Prototype

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2016-04-25
  • 2019-02-27
  • 2014-09-10
  • 1970-01-01
  • 2013-02-08
  • 2017-08-03
  • 2021-08-21
  • 2014-12-19
相关资源
最近更新 更多