简体   繁体   English

你如何使用Firebug检查javascript超时?

[英]How do you inspect a javascript timeout using Firebug?

I suspect I have an issue with a timeout function in javascript that triggers a refresh. 我怀疑我在javascript中触发刷新的超时功能有问题。 Is there a way in Firebug to view what timeouts have been registered? Firebug中有没有办法查看已注册的超时?

Edit: I guess I wasn't clear, is there a way to view the list of timeout callbacks or their status? 编辑:我想我不清楚,有没有办法查看超时回调列表或其状态? (Timeleft, fired or not, registered function, etc....) (Timeleft,是否解雇,注册功能等......)

If you name all the timeouts you can view them in firebug. 如果您命名所有超时,您可以在firebug中查看它们。

var t1 = setTimeout(...,...);

Then in the console you can just type in t1 and press enter 然后在控制台中,您只需键入t1并按Enter键即可

Or type console.log(t1) into the console and press enter 或者在控制台中键入console.log(t1)并按Enter

Just use console.log('your message here'); 只需使用console.log('your message here'); to track your function executions. 跟踪您的功能执行情况。

Call it at the beginning of a function and you will know that that function is being called. 在函数的开头调用它,你就会知道正在调用该函数。

If you place it in the function being called by the setTimeout , you will know how many times it triggered. 如果将它放在setTimeout调用的函数中,您将知道它触发了多少次。

You need to from your javascript send messages to the firebug console. 您需要从您的javascript发送消息到firebug控制台。

should be as easy as console.debug() 应该像console.debug()一样简单

so 所以

setTimeout(
    function()
    {
        console.debug("EVENT!");
    },
    1500
);

see: http://getfirebug.com/wiki/index.php/Console_API 请参阅: http//getfirebug.com/wiki/index.php/Console_API

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM