Packages

class REPLServer extends Object with StObject

Provides a customizable Read-Eval-Print-Loop (REPL).

Instances of repl.REPLServer will accept individual lines of user input, evaluate those according to a user-defined evaluation function, then output the result. Input and output may be from stdin and stdout, respectively, or may be connected to any Node.js stream.

Instances of repl.REPLServer support automatic completion of inputs, simplistic Emacs-style line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session state, error recovery, and customizable evaluation functions.

Instances of repl.REPLServer are created using the repl.start() method and _should not_ be created directly using the JavaScript new keyword.

Annotations
@JSType() @JSImport("repl", "REPLServer") @native()
Source
replMod.scala
See also

https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_repl

Linear Supertypes
StObject, Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. REPLServer
  2. StObject
  3. Object
  4. Any
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new REPLServer()
    Attributes
    protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addListener(event: java.lang.String, listener: Function1[Any, Unit]): REPLServer.this.type

    events.EventEmitter 1.

    events.EventEmitter 1. close - inherited from readline.Interface 2. line - inherited from readline.Interface 3. pause - inherited from readline.Interface 4. resume - inherited from readline.Interface 5. SIGCONT - inherited from readline.Interface 6. SIGINT - inherited from readline.Interface 7. SIGTSTP - inherited from readline.Interface 8. exit 9. reset

  5. def addListener_SIGCONT(event: SIGCONT, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("addListener")
  6. def addListener_SIGINT(event: SIGINT, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("addListener")
  7. def addListener_SIGTSTP(event: SIGTSTP, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("addListener")
  8. def addListener_close(event: close, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("addListener")
  9. def addListener_exit(event: exit, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("addListener")
  10. def addListener_line(event: line, listener: Function1[java.lang.String, Unit]): REPLServer.this.type
    Annotations
    @JSName("addListener")
  11. def addListener_pause(event: pause, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("addListener")
  12. def addListener_reset(event: reset, listener: Function1[Context, Unit]): REPLServer.this.type
    Annotations
    @JSName("addListener")
  13. def addListener_resume(event: resume, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("addListener")
  14. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  15. def clearBufferedCommand(): Unit

    Clears any command that has been buffered but not yet executed.

    Clears any command that has been buffered but not yet executed.

    This method is primarily intended to be called from within the action function for commands registered using the replServer.defineCommand() method.

    Since

    v9.0.0

  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  17. val commands: ReadOnlyDict[REPLCommand]

    The commands registered via replServer.defineCommand().

  18. val completer: |[Completer, AsyncCompleter]

    Specified in the REPL options, this is the function to use for custom Tab auto-completion.

  19. val context: Context

    The vm.Context provided to the eval function to be used for JavaScript evaluation.

  20. def defineCommand(keyword: java.lang.String, cmd: REPLCommandAction): Unit

    Used to add new .-prefixed commands to the REPL instance.

    Used to add new .-prefixed commands to the REPL instance. Such commands are invoked by typing a . followed by the keyword.

    keyword

    The command keyword (_without_ a leading . character).

    cmd

    The function to invoke when the command is processed.

    See also

    https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_replserver_definecommand_keyword_cmd

  21. def defineCommand(keyword: java.lang.String, cmd: REPLCommand): Unit
  22. def displayPrompt(preserveCursor: Boolean): Unit
  23. def displayPrompt(): Unit

    Readies the REPL instance for input from the user, printing the configured prompt to a new line in the output and resuming the input to accept new input.

    Readies the REPL instance for input from the user, printing the configured prompt to a new line in the output and resuming the input to accept new input.

    When multi-line input is being entered, an ellipsis is printed rather than the 'prompt'.

    This method is primarily intended to be called from within the action function for commands registered using the replServer.defineCommand() method.

  24. val editorMode: Boolean

    A value indicating whether the REPL is currently in "editor mode".

    A value indicating whether the REPL is currently in "editor mode".

    See also

    https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys

  25. def emit(event: Symbol, args: Any*): Boolean
  26. def emit(event: java.lang.String, args: Any*): Boolean
  27. def emit_SIGCONT(event: SIGCONT): Boolean
    Annotations
    @JSName("emit")
  28. def emit_SIGINT(event: SIGINT): Boolean
    Annotations
    @JSName("emit")
  29. def emit_SIGTSTP(event: SIGTSTP): Boolean
    Annotations
    @JSName("emit")
  30. def emit_close(event: close): Boolean
    Annotations
    @JSName("emit")
  31. def emit_exit(event: exit): Boolean
    Annotations
    @JSName("emit")
  32. def emit_line(event: line, input: java.lang.String): Boolean
    Annotations
    @JSName("emit")
  33. def emit_pause(event: pause): Boolean
    Annotations
    @JSName("emit")
  34. def emit_reset(event: reset, context: Context): Boolean
    Annotations
    @JSName("emit")
  35. def emit_resume(event: resume): Boolean
    Annotations
    @JSName("emit")
  36. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  37. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  38. def eval(evalCmd: java.lang.String, context: Context, file: java.lang.String, cb: Function2[|[Error, Null], Any, Unit]): Unit

    Specified in the REPL options, this is the function to be used when evaluating each given line of input.

    Specified in the REPL options, this is the function to be used when evaluating each given line of input. If not specified in the REPL options, this is an async wrapper for the JavaScript eval() function.

  39. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  40. def hasOwnProperty(v: scala.Predef.String): Boolean
    Definition Classes
    Object
  41. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  42. val ignoreUndefined: Boolean

    Specified in the REPL options, this is a value indicating whether the default writer function should output the result of a command if it evaluates to undefined.

  43. val input: ReadableStream

    The Readable stream from which REPL input will be read.

  44. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  45. def isPrototypeOf(v: Object): Boolean
    Definition Classes
    Object
  46. val last: Any

    The last evaluation result from the REPL (assigned to the _ variable inside of the REPL).

    The last evaluation result from the REPL (assigned to the _ variable inside of the REPL).

    See also

    https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable

  47. val lastError: Any

    The last error raised inside the REPL (assigned to the _error variable inside of the REPL).

    The last error raised inside the REPL (assigned to the _error variable inside of the REPL).

    Since

    v9.8.0

    See also

    https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable

  48. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  49. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  50. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  51. def on(event: java.lang.String, listener: Function1[Any, Unit]): REPLServer.this.type
  52. def on_SIGCONT(event: SIGCONT, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("on")
  53. def on_SIGINT(event: SIGINT, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("on")
  54. def on_SIGTSTP(event: SIGTSTP, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("on")
  55. def on_close(event: close, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("on")
  56. def on_exit(event: exit, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("on")
  57. def on_line(event: line, listener: Function1[java.lang.String, Unit]): REPLServer.this.type
    Annotations
    @JSName("on")
  58. def on_pause(event: pause, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("on")
  59. def on_reset(event: reset, listener: Function1[Context, Unit]): REPLServer.this.type
    Annotations
    @JSName("on")
  60. def on_resume(event: resume, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("on")
  61. def once(event: java.lang.String, listener: Function1[Any, Unit]): REPLServer.this.type
  62. def once_SIGCONT(event: SIGCONT, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("once")
  63. def once_SIGINT(event: SIGINT, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("once")
  64. def once_SIGTSTP(event: SIGTSTP, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("once")
  65. def once_close(event: close, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("once")
  66. def once_exit(event: exit, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("once")
  67. def once_line(event: line, listener: Function1[java.lang.String, Unit]): REPLServer.this.type
    Annotations
    @JSName("once")
  68. def once_pause(event: pause, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("once")
  69. def once_reset(event: reset, listener: Function1[Context, Unit]): REPLServer.this.type
    Annotations
    @JSName("once")
  70. def once_resume(event: resume, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("once")
  71. val output: WritableStream

    The Writable stream to which REPL output will be written.

  72. def prependListener(event: java.lang.String, listener: Function1[Any, Unit]): REPLServer.this.type
  73. def prependListener_SIGCONT(event: SIGCONT, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependListener")
  74. def prependListener_SIGINT(event: SIGINT, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependListener")
  75. def prependListener_SIGTSTP(event: SIGTSTP, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependListener")
  76. def prependListener_close(event: close, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependListener")
  77. def prependListener_exit(event: exit, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependListener")
  78. def prependListener_line(event: line, listener: Function1[java.lang.String, Unit]): REPLServer.this.type
    Annotations
    @JSName("prependListener")
  79. def prependListener_pause(event: pause, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependListener")
  80. def prependListener_reset(event: reset, listener: Function1[Context, Unit]): REPLServer.this.type
    Annotations
    @JSName("prependListener")
  81. def prependListener_resume(event: resume, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependListener")
  82. def prependOnceListener(event: java.lang.String, listener: Function1[Any, Unit]): REPLServer.this.type
  83. def prependOnceListener_SIGCONT(event: SIGCONT, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependOnceListener")
  84. def prependOnceListener_SIGINT(event: SIGINT, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependOnceListener")
  85. def prependOnceListener_SIGTSTP(event: SIGTSTP, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependOnceListener")
  86. def prependOnceListener_close(event: close, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependOnceListener")
  87. def prependOnceListener_exit(event: exit, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependOnceListener")
  88. def prependOnceListener_line(event: line, listener: Function1[java.lang.String, Unit]): REPLServer.this.type
    Annotations
    @JSName("prependOnceListener")
  89. def prependOnceListener_pause(event: pause, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependOnceListener")
  90. def prependOnceListener_reset(event: reset, listener: Function1[Context, Unit]): REPLServer.this.type
    Annotations
    @JSName("prependOnceListener")
  91. def prependOnceListener_resume(event: resume, listener: Function0[Unit]): REPLServer.this.type
    Annotations
    @JSName("prependOnceListener")
  92. def propertyIsEnumerable(v: scala.Predef.String): Boolean
    Definition Classes
    Object
  93. val replMode: Symbol

    Specified in the REPL options, this is a flag that specifies whether the default eval function should execute all JavaScript commands in strict mode or default (sloppy) mode.

    Specified in the REPL options, this is a flag that specifies whether the default eval function should execute all JavaScript commands in strict mode or default (sloppy) mode. Possible values are: - repl.REPL_MODE_SLOPPY - evaluates expressions in sloppy mode. - repl.REPL_MODE_STRICT - evaluates expressions in strict mode. This is equivalent to prefacing every repl statement with 'use strict'.

  94. def setupHistory(path: java.lang.String, cb: Function2[|[Error, Null], REPLServer.this.type, Unit]): Unit

    Initializes a history log file for the REPL instance.

    Initializes a history log file for the REPL instance. When executing the Node.js binary and using the command line REPL, a history file is initialized by default. However, this is not the case when creating a REPL programmatically. Use this method to initialize a history log file when working with REPL instances programmatically.

    path

    The path to the history file

  95. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  96. def toLocaleString(): scala.Predef.String
    Definition Classes
    Object
  97. def toString(): java.lang.String
    Definition Classes
    AnyRef → Any
  98. val underscoreAssigned: Boolean

    A value indicating whether the _ variable has been assigned.

    A value indicating whether the _ variable has been assigned.

    See also

    https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable

  99. val underscoreErrAssigned: Boolean

    A value indicating whether the _error variable has been assigned.

    A value indicating whether the _error variable has been assigned.

    Since

    v9.8.0

    See also

    https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable

  100. val useColors: Boolean

    Specified in the REPL options, this is a value indicating whether the default writer function should include ANSI color styling to REPL output.

  101. val useGlobal: Boolean

    Specified in the REPL options, this is a value indicating whether the default eval function will use the JavaScript global as the context as opposed to creating a new separate context for the REPL instance.

  102. def valueOf(): Any
    Definition Classes
    Object
  103. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  104. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  105. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  106. def writer(obj: Any): java.lang.String

    Specified in the REPL options, this is the function to invoke to format the output of each command before writing to outputStream.

    Specified in the REPL options, this is the function to invoke to format the output of each command before writing to outputStream. If not specified in the REPL options, this will be a wrapper for util.inspect.

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated
  2. val inputStream: ReadableStream

    Deprecated

    since v14.3.0 - Use input instead.

  3. val outputStream: WritableStream

    Deprecated

    since v14.3.0 - Use output instead.

Inherited from StObject

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped