chotchki
chotchki

Reputation: 4343

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. Is there a way in Firebug to view what timeouts have been registered?

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....)

Upvotes: 7

Views: 1899

Answers (3)

Francis Yaconiello
Francis Yaconiello

Reputation: 10929

You need to from your javascript send messages to the firebug console.

should be as easy as console.debug()

so

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

see: http://getfirebug.com/wiki/index.php/Console_API

Upvotes: 0

Jose Faeti
Jose Faeti

Reputation: 12294

Just use 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.

Upvotes: 0

Naftali
Naftali

Reputation: 146310

If you name all the timeouts you can view them in firebug.

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

Then in the console you can just type in t1 and press enter

Or type console.log(t1) into the console and press enter

Upvotes: 1

Related Questions