Skip to main content

One post tagged with "passive"

View All Tags

· 15 min read

在 Chrome 浏览器中使用以下代码:

document.body.addEventListener("touchmove", (e) => {
console.log(e);
})

会在控制台看到一个警告信息:

[Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952