dvTakeoverScrollScript top-level constant
String
const dvTakeoverScrollScript
Records how far the reader has scrolled the server-rendered document, in
window.__dvScrollY, until the app is in.
The engine fixes the body in place when it starts, which puts the document back at the top, so the app could never ask the window where the reader was. The page shell reads this once and opens the page there. Recording stops once the engine's view is in the document: its own reset to the top is not the reader.
Implementation
const String dvTakeoverScrollScript =
'<script>(function(){var w=window,d=document;function r(){'
'if(!d.querySelector("flutter-view,flt-glass-pane"))w.__dvScrollY=w.scrollY}'
'r();w.addEventListener("scroll",r,{passive:true})})()</script>';