Lightweight Terminal Emulator With Vanilla JavaScript – Jaxit

Category: Javascript | July 31, 2021
Author:CoderUltraSonic
Views Total:67 views
Official Page:Go to website
Last Update:July 31, 2021
License:MIT

Preview:

Lightweight Terminal Emulator With Vanilla JavaScript – Jaxit

Description:

A lightweight JavaScript library to create a configurable, customizable, interactive bash terminal (also called web console) on the page.

How to use it:

1. Import the Jaxit library.

<link rel="stylesheet" href="jaxit.css" />
<script src="jaxit.min.js"></script>
// or
import {createJaxit} from './jaxit.module.min.js';
@import url('./jaxit.css');

2. Initialize the Jaxit.

var jax = createJaxit();
jax.init();

3. Apply default styles to the terminal.

jax.defaultStyle();

4. Print something on the terminal.

// jax.print(string, color);
jax.print('CSSScript.com', '#ffffff');

5. Monitor and react to user input.

// jax.scan(question, text1Color, text2Color, ParseInputIntoInteger, callback)
jax.scan('Your Question', "red", "white", false, function(userInput) {
  jax.print(userInput);
});

6. Clear the terminal.

jax.clear();

7. Change the location of the terminal:

  • top
  • right
  • bottom
  • left
  • fullscreen
jax.changeLocation('fullscreen');

8. Style the terminal using your own CSS.

.jaxit-console {
  ...
}

9. Or via JavaScript.

jax.jaxconsole.style.styleName = VALUE;

10. More API methods.

// set the font family
// google fonts are supported 
jax.changeConsoleFont(newfont);

// set the background color
jax.changeConsoleColor(newcolor);

// set the gradient
jax.changeConsoleColorGradient(arr, type, direction);

// change the size
jax.changeConsoleSize(wantedwidth, wantedHeight, width_measurement_type, height_measure_type);

You Might Be Interested In:


Leave a Reply