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

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

问题描述

我在网站上加载了100-200个javascript函数。
我想确定在Google Chrome中单击一个项目或另一个项目时执行的JavaScript函数。
如何使用Chrome网络开发人员工具进行操作?
Thanks!

解决方案

一个简单的方法是启动Chrome开发者工具,切换到Sources面板并点击 F8 (暂停执行)。这将在第一次执行的JavaScript语句中断开。



另一种方法是为mousedown设置事件侦听器断点,或者在相同的Sources面板中展开Event Listener断点在右侧边栏。展开鼠标项并检查您想要打破的事件(例如点击,ousedown)。然后点击你的页面,在DevTools中看到JS执行中断。享受!

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!

解决方案

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.

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天全站免登陆