Chrome 中的 Javascript 执行跟踪 - 如何? [英] Javascript execution tracking in Chrome - how?

查看:24
本文介绍了Chrome 中的 Javascript 执行跟踪 - 如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个网站上加载了大约 100-200 个 javascript 函数.我想确定当我在 Google Chrome 中单击一项或另一项时执行的 javascript 函数.我如何使用 Chrome 网络开发人员工具做到这一点?谢谢!

I have ~ 100-200 javascript functions loaded on a web-site. I want to determine what javascript function is executed when i click one item or another in Google Chrome. How can i do it with Chrome Web Developer Tools? Thanks!

推荐答案

一种简单的方法是启动 Chrome Developer Tools,切换到 Sources 面板并点击 F8(暂停执行).这将在第一个执行的 JavaScript 语句处中断.

One simple approach is to start Chrome Developer Tools, switch to the Sources panel and hit F8 (Pause Execution). This will break on the first executed JavaScript statement.

另一种方法是为鼠标按下或单击设置事件侦听器断点:在同一个源面板中,展开右侧边栏中的事件侦听器断点".展开鼠标"项并检查要中断的事件(例如单击"、鼠标按下").然后点击你的页面,在 DevTools 中查看 JS 执行中断.享受!

Another approach is to set an event listener breakpoint for mousedown or click: in the same Sources panel, expand the "Event Listener Breakpoints" in the righthand sidebar. Expand the "Mouse" item and check the events you want to break on (e.g. "click", "mousedown"). Then go click in your page and see the JS execution break in the DevTools. Enjoy!

这篇关于Chrome 中的 Javascript 执行跟踪 - 如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆