src/nodejs/jsrepl

Read-Eval-Print-Loop (REPL) implementation that is available both as a standalone program or includible in other applications.

Types

REPLServer = ref object of JsRoot
  options*: JsObject
  builtinModules*: seq[cstring]
https://nodejs.org/api/repl.html#repl_class_replserver

Procs

func defineCommand(self: REPLServer; keyword: cstring; cmd: JsObject) {.
    importjs: "#.$1(#, #)", ...raises: [], tags: [].}
https://nodejs.org/api/repl.html#repl_replserver_definecommand_keyword_cmd
func displayPrompt(self: REPLServer; preserveCursor: bool) {.
    importjs: "#.$1(#)", ...raises: [], tags: [].}
https://nodejs.org/api/repl.html#repl_replserver_displayprompt_preservecursor
func importRepl() {.importjs: "import * as repl from \'repl\'@", ...raises: [],
                    tags: [].}
Alias for import * as module_name from 'module_name';. Must be called once before using the module
func newREPLServer(options: JsObject): REPLServer {.importjs: "repl.start(#)",
    ...raises: [], tags: [].}
Alias for repl.start(options).
func onExit[T](self: REPLServer; callback: T) {.importjs: "#.on(\'exit\', #)",
    ...raises: [], tags: [].}
Alias for repl.on('exit', callback).
func onReset(self: REPLServer; item: auto) {.importjs: "#.on(\'reset\', #)",
    ...raises: [], tags: [].}
Alias for repl.on('reset', item).
func parseREPLKeyword(self: REPLServer; keyword: cstring; rest: auto): bool {.
    importjs: "#.$1(#, #)", ...raises: [], tags: [].}
https://nodejs.org/api/repl.html#repl_replserver_parsereplkeyword_keyword_rest
func requireRepl() {.importjs: "const repl = require(\'repl\')@", ...raises: [],
                     tags: [].}
Alias for const module_name = require('module_name');. Must be called once before using the module
func setupHistory[T](self: REPLServer; historyPath: cstring; callback: T) {.
    importjs: "#.$1(#, #)", ...raises: [], tags: [].}
https://nodejs.org/api/repl.html#repl_replserver_setuphistory_historypath_callback