foolishman

Results 12 comments of foolishman

有个问题,如何收集页面首屏渲染指标呢,是用文中的PerformancePaintTiming呢还是用PerformanceNavigationTiming里边的各种属性计算呢,网上其他文章很多都是根据Performance Timing API也就是PerformanceNavigationTiming计算的,然后就不知道怎么样了

> @GeWeidong 可以参考下这个仓库:https://github.com/GoogleChrome/web-vitals 这个今天刚看到了,可以获取到FCP、LCP、FID、CLS、TTFB指标,但是有浏览器兼容性问题。 我也推荐个吧:https://github.com/Zizzamia/perfume.js,这个原理还没看,据说无兼容性问题。

> 「是否可以通过state里面的offsetY设置滚动条的偏移量」,应该是可以的,上次我也这么尝试过,不过上次遇到了两个问题比较麻烦: > > * 没有开启虚拟滚动的时候,offsetY 是没有值的 > * 虚拟滚动现在有 100px 的 overscan(过扫描,就是上下多渲染 100像素的内容),现在内部计算偏移量的时候都会考虑到 overscan,但是要让外部控制滚动的话,又需要将 overscan 设置为 0。也就是说表格内部的 overscan 不能像现在这样写成常量了,这个有一定的开发成本 > > 最近工作比较忙,估计短时间内不会实现这个功能 这个问题怎么样了大佬,我也遇到了需要滚动到指定行的功能,有思路可以实现吗

> > > > > > > 碰到一样的问题,mark > > > > > > > > > > > > > > > > > > 没找到方案,避开了,放弃了模块联邦 > > >...

> > > > > > > > > 碰到一样的问题,mark > > > > > > > > > > > > > > > > > > > >...

```javascript // 定义三种状态 const PENDING = 'PENDING'; const FULFILLED = 'FULFILLED'; const REJECT = 'REJECT'; class MyPromise { constructor(fn){ // 初始化状态 this.status = PENDING; // 将成功、失败的结果放在this上,便于then、catch访问 this.value = null; this.reason...

```javascript // 1. function repeat(func, times, wait) { return function(...args) { for (let i = 0;i < times;i++) { setTimeout(() => { func(...args); }, wait * i); } } }...

立即执行函数内部声明test,会存在变量提升。

> 将module-federation-remote中的library.type改为window 就能work了。 > > ```js > new ModuleFederationPlugin({ > name: "eppComponent", > library: { type: "window", name: "eppComponent" }, > filename: "mf.js", > exposes: { > "./tester": path.resolve(__dirname, "./tester.jsx"),...

``` type A = 'a' | 'b' | 'c'; type B = 'a' | 'd'; type MyExclude = T extends U ? never : T; type C = MyExclude; ```...