diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 64baf58867..5f07fa6f7a 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -645,6 +645,14 @@ with inappropriate names has been deprecated. *Note*: As the original API was undocumented and not generally useful for non-internal code, no replacement API is provided. + +### DEP0074: REPLServer.bufferedCommand + +Type: Runtime + +The `REPLServer.bufferedCommand` property was deprecated in favor of +[`REPLServer.clearBufferedCommand()`][]. + [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array [`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer @@ -708,3 +716,4 @@ non-internal code, no replacement API is provided. [alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size [from_arraybuffer]: buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length [from_string_encoding]: buffer.html#buffer_class_method_buffer_from_string_encoding +[`REPLServer.clearBufferedCommand()`]: repl.html#repl_replserver_clearbufferedcommand diff --git a/doc/api/repl.md b/doc/api/repl.md index f276b965bd..7a9c1f81e5 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -335,7 +335,7 @@ const replServer = repl.start({ prompt: '> ' }); replServer.defineCommand('sayhello', { help: 'Say hello', action(name) { - this.bufferedCommand = ''; + this.clearBufferedCommand(); console.log(`Hello, ${name}!`); this.displayPrompt(); } @@ -375,6 +375,16 @@ The `replServer.displayPrompt` method is primarily intended to be called from within the action function for commands registered using the `replServer.defineCommand()` method. +### replServer.clearBufferedCommand() + + +The `replServer.clearBufferedComand()` method 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. + ## repl.start([options])