我正在尝试从文档中使用 REPL 中内置的 nodejs。
http://nodejs.org/api/repl.html
添加项目的示例如下:
repl.start().context.m = msg;
我似乎找不到添加多个菜单的方法。我试过做:
menus = {m = 'hello', f = 'foo'}
repl.start().context = menus
但这也行不通。我得到:
testREPL> m
TypeError: needs a 'context' argument.
at REPLServer.self.eval (repl.js:113:21)
at Interface.<anonymous> (repl.js:250:12)
at Interface.EventEmitter.emit (events.js:88:17)
at Interface._onLine (readline.js:199:10)
at Interface._normalWrite._line_buffer (readline.js:308:12)
at Array.forEach (native)
at Interface._normalWrite (readline.js:307:11)
at Socket.ondata (readline.js:90:10)
at Socket.EventEmitter.emit (events.js:115:20)
at TCP.onread (net.js:395:14)
有谁知道如何让这个工作?