admin管理员组

文章数量:1290536

I am studying this page: / 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?

I am studying this page: http://www.fxstreet./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?

Share Improve this question edited Nov 11, 2011 at 1:20 Wayne Koorts 11.1k13 gold badges48 silver badges72 bronze badges asked Nov 11, 2011 at 1:10 EndangeringSpeciesEndangeringSpecies 1,5941 gold badge17 silver badges39 bronze badges 1
  • In Chrome, you can view the XMLHttpRequests by selecting that option in the right click menu of the console window. – Blender Commented Nov 11, 2011 at 1:12
Add a ment  | 

3 Answers 3

Reset to default 9

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.

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

In firebug, or chrome dev tools, select the js file etd-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 _plete

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.

本文标签: