简体   繁体   English

Chrome开发人员工具跟踪功能序列

[英]Chrome developer tool trace function sequences

I am a newbie to Chrome developer tool and I found it is very powerful. 我是Chrome开发人员工具的新手,我发现它非常强大。 Currently, I am looking for a way to trace the flow of functions when I open a webpage and also, I am wondering is there s how can I find which function does an element trigger when it is clicked. 目前,我正在寻找一种方法来跟踪打开网页时的功能流程,而且,我想知道如何在单击时找到元素触发的功能。 Here are some examples: 这里有些例子:

1) Tracing function sequences: For example, there are 20 functions in my script. 1)跟踪功能序列:例如,我的脚本中有20个功能。 Some of the functions will call the other functions. 某些功能会调用其他功能。 I would like to trace the function calls. 我想跟踪函数调用。 Like which function is called first and then what functions are called following by this function. 就像首先调用哪个函数一样,然后调用此函数调用的函数。 Since these 20 functions are pretty huge, it is quite hard to follow the sequence by just looking at the script. 由于这20个函数非常庞大,因此只需查看脚本就很难按顺序执行。

2) Which function does an element trigger in javascript: For example, I have one button on the webpage, there is one or are more functions associated with this element. 2)元素在javascript中触发哪个函数:例如,我在网页上有一个按钮,有一个或多个与此元素关联的函数。 By using the Event Listener of Chrome developer tool, I can only see some DOM elements under "Click" rather what function it is associated with. 通过使用Chrome开发者工具的事件监听器,我只能在“点击”下看到一些DOM元素,而不是与之关联的功能。

Is there a way to find associated functions? 有没有办法找到相关的功能?

I appreciate you help! 我感谢你的帮助!

  1. In Sources panel, there is a Call Stack tab, in which you could see the function call stack when code execution was halted at break points. Sources面板中,有一个Call Stack选项卡,当您在断点处停止代码执行时,您可以在其中看到函数调用堆栈。

    在此输入图像描述

  2. In Elements panel, there is an Event Listeners tab, in which you could see all event handlers bond to the element, as well as where it is in source code. 在“ 元素”面板中,有一个“ 事件侦听器”选项卡,您可以在其中看到所有事件处理程序与元素绑定,以及它在源代码中的位置。

    在此输入图像描述

I suggest you to read some tutorials, for example this and this , and there are more. 我建议你阅读一些教程,比如这个这个 ,还有更多。 So that you could know more about it and boost your development. 这样您就可以了解更多信息并促进您的发展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM