Warning: Undefined global variable $debug in /var/www/ourcoders/tiny4cocoa/application/controllers/baseController.php on line 124
貘吃馍香 2019-10-14 00:00:00 发布的技术动态 - OurCoders (我们程序员)
貘吃馍香
2019-10-14 00:00:00 发布
由于某些未知力量的作用,想用下 performance API,然后用 performance.getEntriesByName 时候不知道 type 和 name 参数值字符串有哪些,草草看了下 performance 哪几个规范,没找到…… 只好去翻了 Chromium 的,就这些……
static const NameEntry kNames[] = {
{ "element", 10847290, 7 },
{ "event", 4205160, 5 },
{ "first-input", 15327281, 11 },
{ "largest-contentful-paint", 15991029, 24 },
{ "layout-shift", 11494461, 12 },
{ "longtask", 10552953, 8 },
{ "mark", 16508213, 4 },
{ "measure", 14276612, 7 },
{ "navigation", 7522544, 10 },
{ "paint", 14181688, 5 },
{ "resource", 2370048, 8 },
{ "taskattribution", 3833465, 15 },
};
然后呢 ……
想起 PerformanceObserver 里也有 entryType 相关的……
去看了规范 ……
顺利链接到了 …… Timing Entry Names Registry …… 网页链接
完全一样的 …… 瞎耽误功夫跟代码 ……
不过绕弯的好处有俩:
一个是用 performance.getEntriesByType 调用发现
largest-contentful-paint、element、event 、
longtask、 layout-shift 都提示 Deprecated 了……
另一个是规范表里的 maxBufferSize,数量大时候可能会踩这个坑。
(几年前踩过 resource 150条的坑……现在已经是250条了……)