我有以下代码在 Chrome (V8) 下运行良好,但在节点内失败:
var id;
id = setTimeout("TimeoutHandler()", 10);
console.log ('SET');
function TimeoutHandler()
{
clearTimeout(id);
console.log ('CLEAR');
}
铬输出:
SET
CLEAR
节点输出:
SET
timers.js:110
first._onTimeout();
^
TypeError: Property '_onTimeout' of object [object Object] is not a function
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
任何想法为什么?谢谢