我如何找到/分析“现在”正在执行的 JavaScript?使用 Firebug 还是其他方式?

发布于 2024-12-15 01:13:43 字数 366 浏览 2 评论 0原文

我正在研究此页面: http://www.fxstreet.com/rates-charts/ currency-rates/ 由 JavaScript 使用来自服务器的新数据不断更新。很明显,页面中不断执行一些 JavaScript 函数。因此,我打开 Firebug,但没有看到任何“分析器”类型的输出,该输出会不断添加有关执行脚本的新信息。 “脚本”选项卡仅显示 46 条不太清晰的记录,没有时间戳,也没有任何迹象表明有持续的新 JavaScript 活动需要分析。

我做错了什么?如何了解页面上的 JavaScript 活动?

I am studying this page: http://www.fxstreet.com/rates-charts/currency-rates/ which is continually updated by JavaScript with new data from the server. So clearly there is some JavaScript function continually executing in the page. So I opened Firebug and I don't see any "profiler" type output that would continually add new info about executing scripts. The "script" tab only shows 46 not very clear records, without timestamps and without any indication that there is continual new JavaScript activity to profile.

What am I doing wrong? How do I go about groking the JavaScript activity on a page?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

墨离汐 2024-12-22 01:13:43

在 Firebug 的 Console 选项卡中,ClearPersist 旁边有一个 Profile 按钮,它可以执行您的操作正在尝试做。它不是实时的,但您可以让它运行一段时间,然后分析结果,这应该会告诉您您正在寻找什么。

In the Console tab of Firebug there is a Profile button next to Clear and Persist, which does what you're trying to do. It's not real-time but you can let it run for a certain time period and analyse the results afterwards which should show you what you're looking for.

梦毁影碎の 2024-12-22 01:13:43

您可以执行以下三件事之一:

  • 放入 console.log() 行,以将您希望在应用程序运行时看到的数据输出到控制台
  • 。 application
  • 在代码中放置断点并手动调试代码,逐步查看其运行情况

如果您要查找的是服务器请求/响应信息,则需要查看 firebug 的“Net”选项卡

You can do one of three things

  • Put in console.log() lines to output to the console what data you want to see as your application is running
  • add "watches" to objects in your application which will automatically update when that object changes in your application
  • Put breakpoints in your code and manually debug through your code step by step to see how it is running

If it is server request/response information you are looking for you want to look at the "Net" tab of firebug

小…红帽 2024-12-22 01:13:43

在 firebug 或 chrome 开发工具中,选择 js 文件 cometd-1.1.2-teletrader.js。到达那里后,您可以在第 167 行设置断点,或者:

function _longpollComplete

您也可以在第 171 行设置断点:

function _complete

一旦您进入代码,您可以看到返回的对象,其中包含更新网格的数据。您可以进入 _longpoolComplete 并查看数据结构:

0: Object
频道:“/teletrader/symbols/3212198”
数据:对象
变化:“0.0124”
变化百分比:“0.1848”
日期时间:“2011 年 11 月 11 日 02:19:20”
最后:“6.6964”
符号 ID:3212198

1:对象
频道:“/teletrader/symbols/3212160”
数据:对象
更改:“-0.2725”
变化百分比:“-0.2202”
日期时间:“2011 年 11 月 11 日 02:19:21”
最后:“123.4650”
符号ID:3212160

In firebug, or chrome dev tools, select the js file cometd-1.1.2-teletrader.js. Once there, you can set a breakpoint at line 167 or :

function _longpollComplete

you can also put a breakpoint at line 171 :

function _complete

once you break into the code you can see the objects being returned which contain the data which update the grid. you can step into _longpoolComplete and see the data structure :

0: Object
channel: "/teletrader/symbols/3212198"
data: Object
change: "0.0124"
changePercent: "0.1848"
dateTime: "11.11.2011 02:19:20"
last: "6.6964"
symbolId: 3212198

1: Object
channel: "/teletrader/symbols/3212160"
data: Object
change: "-0.2725"
changePercent: "-0.2202"
dateTime: "11.11.2011 02:19:21"
last: "123.4650"
symbolId: 3212160

etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文