简体   繁体   English

如何查找JavaScript函数调用流程

[英]How to find JavaScript function call flow

Is there any plugins to know the complete flow of JavaScript function call in the client side? 是否有任何插件可以了解客户端中JavaScript函数调用的完整流程?

I did not find any thing such that in Firebug. 我在Firebug中找不到任何东西。 But I am not confirm because my knowledge on Firebug is limited. 但是我不确定,因为我对Firebug的了解有限。

Or any there any other plugins or tools, except putting console out in every function and alerts? 还是有任何其他插件或工具,除了在每个功能和警报中添加控制台之外?

you could try putting a debugger somewhere in the code and once the debugger is hit you can watch the stack trace. 您可以尝试将调试器放在代码中的某个位置,一旦调试器被点击,您就可以查看堆栈跟踪。 This would enable you to see the flow only until the point where debugger is hit though. 这将使您仅在点击调试器之前才能看到流程。

You can enable the script tab in Firebug and use the checkpoints for a particular script or JS file. 您可以在Firebug中启用脚本标签,并为特定script或JS文件使用检查点。

Read more about Script Panel 阅读有关脚本面板的更多信息

Most modern browsers allow you to view the stack trace while in debug mode. 大多数现代浏览器都允许您在调试模式下查看堆栈跟踪。 Firebug offers two different ways to get the stack trace of a function call. Firebug提供了两种不同的方法来获取函数调用的堆栈跟踪。

  1. Check the information inside the Script panel 检查“ 脚本”面板中的信息

    When the script execution is halted, you can also always see the stack trace inside the Script panel's toolbar as well as inside the Stack side panel . 暂停脚本执行后,您还可以始终在“ 脚本”面板的工具栏内以及“ 堆栈”侧面板内看到堆栈跟踪。

  2. Use console.trace() 使用console.trace()

    Prints an interactive stack trace of JavaScript execution at the point where it is called. 在调用时打印交互式的JavaScript执行堆栈跟踪。

    The stack trace details the functions on the stack, as well as the values that were passed as arguments to each function. 堆栈跟踪详细说明了堆栈上的函数以及作为参数传递给每个函数的值。 You can click each function to take you to its source in the Script Panel, and click each argument value to inspect it in the DOM or HTML Panel. 您可以单击每个函数以将其带到脚本面板中的源,然后单击每个参数值以在DOM或HTML面板中对其进行检查。

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

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