Author: | ines |
---|---|
Views Total: | 2,333 views |
Official Page: | Go to website |
Last Update: | June 9, 2017 |
License: | MIT |
Preview:

Description:
termynal.js is a lightweight, standalone JavaScript library that adds an animated, configurable terminal to your web application.
Has support for ‘async’ function and ‘await’ expression.
Basic usage:
Include the termynal’s stylesheet to style the terminal.
<link rel="stylesheet" href="termynal.css">
Create a termynal container with the data-termynal attribute and termynal ID, and then config the terminal with the following ‘data’ attributes:
- data-ty-typeDelay: delay between each typed character
- data-ty-lineDelay: delay between each typed line
- data-ty-startDelay: delay before typing
- data-ty-prompt: prompt style
- data-ty-progressChar: character to use for progress bar
- data-ty-progressLength: number of characters displayed as progress bar
- data-ty-cursor: character to use for blinking cursor
<div id="termynal" data-termynal data-ty-typeDelay="40" data-ty-lineDelay="700"> <span data-ty="input" data-ty-prompt="▲">npm uninstall react</span> <span data-ty>Are you sure you want to uninstall 'react'?</span> <span data-ty="input" data-ty-typeDelay="1000" data-ty-prompt="(y/n)">y</span> <span data-ty="progress" data-ty-progressChar="·"></span> <span data-ty>Uninstalled 'react'</span> <span data-ty="input" data-ty-prompt="▲">node</span> <span data-ty="input" data-ty-prompt=">">Array(5).fill('? ')</span> <span data-ty>['?', '?', '?', '?', '?']</span> <span data-ty="input" data-ty-prompt="▲">cd ~/repos</span> <span data-ty="input" data-ty-prompt="▲ ~/repos"> git checkout branch master</span> <span data-ty="input" data-ty-prompt="▲ ~/repos (master)">git commit -m "Fix things"</span> </div>
Include the main JavaScript at the bottom of the webpage. Done.
<script src="termynal.js" data-termynal-container="#termynal"></script>