2012-06-11 74 views
0

我想用window.setTimeout運行在TruClient(火狐)的函數每0.1秒時:無法使用window.setTimeout在阿賈克斯Truclient

function foobar(delay_accumulator){ 
    if(delay_accumulator >= 100)//10 seconds 
     return; 

    //do something 
    window.setTimeout(function() { foobar(delay_accumulator+1); }, 100); 
} 
foobar(0); 

然而,步驟失敗,給了以下錯誤:

** 2: Evaluate JavaScript code function foobar(delay_accumula...OBAR"); foobar(0); ** failed - exception occured: NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMJSWindow.setTimeout]

setTimeout爲什麼不可用?我可以使用其他解決方案嗎?

編輯:Truclient在工具箱中有一個「等待」功能,但它的最小粒度爲1秒,而setTimeout的最小粒度爲毫秒。

回答