【发布时间】:2011-06-18 07:44:05
【问题描述】:
您好,我们正在 node.js 、 socket.io 和 redis 中开发应用程序。
我们有这个程序:
exports.processRequest = function (request,result) {
var self = this;
var timerknock;
switch(request._command) {
case 'some command': // user login with username
// some statement
timerknock=setTimeout(function() {
//some statemetn
},20*1000);
case 'other command ':
// some statement
clearTimeout(timerknock);
}
};
但是当它取消计时器时,执行其他命令时它没有被取消,我应该怎么做才能取消计时器?
【问题讨论】:
标签: node.js settimeout socket.io