mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-14 10:05:41 +00:00
fmt: Cleanup terminal code (#381)
* fmt: Clean up OutputTerminal code * fmt: Clean up OutputTerminal code
This commit is contained in:
30
webui.dev/js/OutputTerminal.js
Normal file
30
webui.dev/js/OutputTerminal.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Terminal } from '@xterm/xterm'
|
||||
import { FitAddon } from '@xterm/addon-fit'
|
||||
|
||||
export class OutputTerminal {
|
||||
constructor () {
|
||||
this.terminal = new Terminal({
|
||||
convertEol: true
|
||||
})
|
||||
|
||||
const fitAddon = new FitAddon()
|
||||
this.terminal.loadAddon(fitAddon)
|
||||
this.terminal.fit = fitAddon
|
||||
}
|
||||
|
||||
write (out, then) {
|
||||
this.terminal.write(out, then)
|
||||
}
|
||||
|
||||
fit () {
|
||||
this.terminal.fit.fit()
|
||||
}
|
||||
|
||||
open (el) {
|
||||
this.terminal.open(el)
|
||||
}
|
||||
|
||||
reset () {
|
||||
this.terminal.reset()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user