pause-repl
Function that opens a node.js REPL and returns a promise that resolves only when unpause()
is called in the REPL.
When you await
for this function to return, it will pause a script and open an interactive session.
Installation
$ npm install pause-repl
Usage
Import the pause
function from pause-repl
.
const pause = ;
await pause()
from an async
function to open a REPL.
await ;
Pass any object to pause()
to expose its properties to the REPL.
await ;
While pause()
returns a promise and is intended to be used in an async/await
context but it can be used like any other promise. The unpause()
function is attached to the promise so you can unpause programmatically, like in a timeout or when another action completes.
const pausedRepl = await ;pausedRepl;pausedRepl;
Example
const pause = ; async { const replContext = 'Hello you!' // greet() will be availble in the REPL ; await ; // the script won't continue until unpaused()-ed from the REPL. console;};