简体   繁体   English

如何使用Firebug或任何其他方式“立即”查找/分析正在执行的JavaScript?

[英]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选项卡中, ClearPersist旁边有一个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 你可以做三件事之一

  • Put in console.log() lines to output to the console what data you want to see as your application is running 放入console.log()行以向控制台输出在应用程序运行时要查看的数据
  • 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 如果是您要查找的服务器请求/响应信息,请查看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.

相关问题 Javascript,Firebug:我如何拥有多个视图或开发的正确方式是什么? - Javascript, Firebug: How do I have multiple views or what is the right of way of doing development? 如何使用 Firebug 或任何其他扩展程序查找哪些 Javascript 代码触发表单提交? - How to find with Firebug or any other extension what Javascript code triggers form submission? 我如何使用Firebug告诉我什么是JavaScript被解雇? - How do I use Firebug to tell me what JavaScript is being fired? 有没有办法确定是否正在执行execCommand('bold')? - Is there a way to determine if execCommand('bold') is being executed right now? 有没有办法在不使用Firebug的情况下查看Firefox中执行的JavaScript的痕迹? - Is there a way to see a trace of the executed JavaScript in Firefox without using Firebug? 我怎么知道现在没有一个 AJAX 请求正在执行? - How can I know that no one AJAX request is being executed right now? 告诉Firebug在任何Javascript被执行后很快就会破坏 - Telling Firebug to Break as Soon as any Javascript is Executed javascript FF Firebug profile()-获取结果的方法? - javascript FF Firebug profile() - way to get the results? 如何在Firebug控制台中加载JavaScript? - How do I load javascript with the firebug console? 如何在Firebug或任何其他插件中查看跨域Javascript请求? - How to view cross domain Javascript requests in Firebug or any other plugin?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM