CNode

怎么样才能不报不能识别setTimeOut

Eeyauwag发布于13 年前最后回复13 年前3 回复4166 浏览0 收藏

为什么不能识别我的代码里面的setTimeOut?why,why,why var timers = require("timers");

var redis = require("redis"), client = redis.createClient();

client.on("error", function (err) { console.log("error event - " + client.host + ":" + client.port + " - " + err); }); console.log("aaa.");

var id = timers.setTimeOut(function (){ client.set("string key", "string val", redis.print); console.log("hhhhh."); client.quit(); console.log("ggg."); },2000);

查看回复

回复 (3)

H
hexie#1·13 年前

你的最后打印信息是什么?

E
eyauwag#2·13 年前
引用 hexie你的最后打印信息是什么?

我在this.stream.on("connect", function () { console.log("on connect"); self.on_connect(); }); 里面添加了打印,在send_command里面也添加了打印。打印的结果是,首先打印 “on _connect”,然后打印的是send_command里面的内容。这个恰好是我希望看到的。

E
eyauwag#3·13 年前
引用 hexie你的最后打印信息是什么?

是我写错了,应该是setTimeout

参与回复
登录后即可参与回复。登录