我有一个小型示例程序http://pastebin.com/5gFkaPgg通过 TCP 向客户端提供 REPL。根据文档http://nodejs.org/api/repl.html我正确设置了 eval 函数(第 11-13 行),但回调对象不是函数。我在文档中误解了什么?
callback(null,result);
^
TypeError: object is not a function
无法回答我自己的问题...
根据https://github.com/joyent/node/blob/master/lib/repl.js 签名是
function(code, context, file, cb) {
//code
cb(err, result);
}
让我知道是否有更合适的解决方案。