2.0.7 • Published 2 years ago

terminal-duplex v2.0.7

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
2 years ago

terminal-duplex

const Terminal = require('terminal-duplex')
const terminal = new Terminal()

x.on('some output', data=> terminal.log(data)) //console.logs
const listener = input=> terminal.log('user inputted:', input)
terminal.listen(listener) //can add as many as you want

terminal.unlisten(listener) //if you want you can also unlisten when you're done

terminal.close() //unhooks from input and outputs

alternatively instead of using terminal.log you could just pass true into the constructor and it will overwrite console.log everywhere.

const Terminal = require('terminal-duplex')
const terminal = new Terminal(true)

x.on('some output', data=> console.log(data))
const listener = input=> console.log('user inputted:', input)
terminal.listen(listener) //can add as many as you want

terminal.unlisten(listener) //if you want you can also unlisten when you're done

terminal.close() //unhooks from input and outputs

What is this?

Turns this:

image

Into this:

image

image

image

Amazingly something like this didn't exist already.

2.0.7

2 years ago

2.0.6

3 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago