[英]How do I find/profile what JavaScript is being executed “right now” using Firebug or any other way?
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. 我正在研究这个页面: http : //www.fxstreet.com/rates-charts/currency-rates/ ,它通过JavaScript不断更新来自服务器的新数据。 So clearly there is some JavaScript function continually executing in the page.
很明显,页面中有一些JavaScript函数在不断执行。 So I opened Firebug and I don't see any "profiler" type output that would continually add new info about executing scripts.
所以我打开了Firebug,我没有看到任何“profiler”类型输出会不断添加有关执行脚本的新信息。 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.
“脚本”选项卡仅显示46条不太清晰的记录,没有时间戳,也没有任何迹象表明存在连续的新JavaScript活动。
What am I doing wrong? 我究竟做错了什么? How do I go about groking the JavaScript activity on a page?
如何在页面上浏览JavaScript活动?
In the Console
tab of Firebug there is a Profile
button next to Clear
and Persist
, which does what you're trying to do. 在Firebug的
Console
选项卡中, Clear
和Persist
旁边有一个Profile
按钮,可以执行您要执行的操作。 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. 这不是实时的,但你可以让它运行一段时间并分析之后的结果,这些结果应该显示你正在寻找的东西。
You can do one of three things 你可以做三件事之一
If it is server request/response information you are looking for you want to look at the "Net" tab of firebug 如果是您要查找的服务器请求/响应信息,请查看firebug的“Net”选项卡
In firebug, or chrome dev tools, select the js file cometd-1.1.2-teletrader.js. 在firebug或chrome dev工具中,选择js文件cometd-1.1.2-teletrader.js。 Once there, you can set a breakpoint at line 167 or :
在那里,您可以在第167行设置断点或:
function _longpollComplete
you can also put a breakpoint at line 171 : 你也可以在第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 :
你可以进入_longpoolComplete并查看数据结构:
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 0:对象通道:“/ teletrader / symbols / 3212198”数据:对象更改:“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 1:对象通道:“/ teletrader / symbols / 3212160”数据:对象更改:“ - 0.2725”changePercent:“ - 0。2202”dateTime:“11.11.2011 02:19:21”last:“123.4650”symbolId:3212160
etc. 等等
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.