【发布时间】:2014-01-14 07:11:07
【问题描述】:
function TimerSystem() {
this.timer = null;
this.addTimer = function(timer, delay) {
this.timer = timer;
setTimeout(function() {
timerSystem.timer = null;
}, delay);
};
}
var timerSystem = new TimerSystem();
timerSystem.addTimer(setTimeout(function() {
//do something...
}, 1000), 1000);
它在我的源代码中工作。 让我知道这种方式是否正确? 我认为这不聪明
【问题讨论】:
标签: javascript settimeout