如何在JavaScript函数调用发生时查看它们 [英] How to view JavaScript function calls as they occur

查看:172
本文介绍了如何在JavaScript函数调用发生时查看它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在浏览器的JavaScript控制台中查看JavaScript函数调用?我知道你可以查看XHR,但你可以查看函数调用吗?



例如,我将鼠标悬停在页面上的某个元素上,然后弹出一个div。我知道有一个JavaScript函数被调用来显示弹出窗口,所以能够在控制台中查看这个调用会很好,所以我可以看到调用了什么函数。



我错过了什么或者这是不可能的?

解决方案

所以基本上你想要实时查看JS电话?



Firefox上的Firebug扩展程序提供了这些功能( http:// getfirebug.com/javascript )。



基本上,您要做的是在代码中找到您的函数,然后在其上设置断点。然后,您应该能够逐步执行它,就像普通的调试器一样。不应该很难找到与a和特定事件(例如鼠标悬停)相关联的JS函数 - 这个页面是使用直接JS还是框架?如果是这样,哪一个?



Google Chrome的内置开发者工具提供了一个较小的子集 - 根据您的需要,它上面的配置文件选项卡可能有用吗? / p>

你究竟需要追踪这个JS函数到底是什么?我们可能会根据您的特殊需求为您推荐更好的工具。


Is it possible to view JavaScript function calls in the browser's JavaScript console? I know you can view XHR, but can you view function calls?

For example, I hover my mouse over some element on a page and a div pops up. I know there was a JavaScript function that was called to show the popup so it would be nice to be able to view this call in the console so I can see what function was called.

Am I missing something or is this not possible?

解决方案

So basically you want to view JS calls in real-time?

The Firebug extension on Firefox offers that (http://getfirebug.com/javascript).

Basically, what you want to do is find your function within your code, then set a breakpoint on it. You should then be able to step through execution on it, just like a normal debugger. It shouldn't be hard to find the JS function associated with a and a particular event (e.g. mouseover) on that - is this page in question using straight JS or a framework? And if so, which one?

Google Chrome's built-in developer tools offer a smaller subset - depending on what you want, the Profile tab on it might be useful?

What exactly do you need to trace this JS function for? We might be able to recommend a better tool for you based on your particular need.

这篇关于如何在JavaScript函数调用发生时查看它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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