a970891
V2EX  ›  Apple

iOS 中有什么办法可以监听 WKWebView 的首屏渲染耗时吗?

  •  
  •   a970891 · Apr 19, 2022 · 2137 views
    This topic created in 1487 days ago, the information mentioned may be changed or developed.

    如题,想要从 WebKit 内核获取 H5 的 T2 时间,目前想到的办法是监听 privateNavigationProtocol 的私有 api ,然后注册 renderMileStone 的事件,但是拿到的 first meanful paint 事件实测并不是上屏时间,只是渲染指令发出的时间,然后又去 hook 了 commitLayerTree ,在里面监听了 WKScrollView 的 contentSize 变化,但是无法处理页面内容不满一屏的情况。

    是否有其他更科学的方法?求指点!

    4 replies    2022-04-20 09:32:59 +08:00
    dcty
        1
    dcty  
       Apr 19, 2022 via iPhone
    截图,检测内容🤣
    wobuhuicode
        2
    wobuhuicode  
       Apr 19, 2022 via iPhone
    让前端自己计时
    a970891
        3
    a970891  
    OP
       Apr 20, 2022
    前端计时不准
    a970891
        4
    a970891  
    OP
       Apr 20, 2022
    @wobuhuicode 前端计时不准
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   972 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 19:14 · PVG 03:14 · LAX 12:14 · JFK 15:14
    ♥ Do have faith in what you're doing.