How to use ng-terminal - 1 common examples

To help you get started, we’ve selected a few ng-terminal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qwefgh90 / ng-terminal / src / app / example.component.ts View on Github external
this.child.keyEventInput.subscribe(e => {
      console.log('keyboard event:' + e.domEvent.keyCode + ', ' + e.key);

      const ev = e.domEvent;
      const printable = !ev.altKey && !ev.ctrlKey && !ev.metaKey;

      if (ev.keyCode === 13) {
        this.child.write('\n' + FunctionsUsingCSI.cursorColumn(1) + '$ '); // \r\n
      } else if (ev.keyCode === 8) {
        // Do not delete the prompt
        if (this.child.underlying.buffer.cursorX > 2) {
          this.child.write('\b \b');
        }
      } else if (printable) {
        this.child.write(e.key);
      }
    })
    this.rowsControl.valueChanges.subscribe(() => { this.invalidate() });

ng-terminal

NgTerminal is a terminal component on Angular 16 or higher.

MIT
Latest version published 30 days ago

Package Health Score

65 / 100
Full package analysis

Popular ng-terminal functions