https://github.com/lzinga/ascii-loader
A javascript plugin used to create ASCII style progress bars.
https://github.com/lzinga/ascii-loader
Last synced: 5 months ago
JSON representation
A javascript plugin used to create ASCII style progress bars.
- Host: GitHub
- URL: https://github.com/lzinga/ascii-loader
- Owner: lzinga
- License: mit
- Created: 2020-06-01T01:46:52.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-01T16:24:13.000Z (about 6 years ago)
- Last Synced: 2025-01-19T08:33:10.901Z (over 1 year ago)
- Language: HTML
- Homepage: https://lzinga.github.io/ASCII-Loader/
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ascii Loader
After a while searching for a simple ASCII loader and failing, I quickly made one. Is this one perfect? No. Will it break? Probably.
You can view a demo of it located at the link below which will allow you to adjust each setting and see the changes.
[View Demo](https://lzinga.github.io/ASCII-Loader/)
## Config
```javascript
// Creates a default progress bar with the default options.
var progressbar = new AsciiProgress("progressbar")
// Creates a progress bar with an options object passed in.
var progressbar = new AsciiProgress("progressbar", options)
```
#### Default Options
```javascript
{
openCharacter: "[",
loadedCharacter: "#",
backgroundCharacter: " ",
closeCharacter: "]",
showComment: true,
startingComment: " ",
commentLocation: "bottom",
length: 60,
value: 0,
completeAt: 100,
showPercent: true,
percentDecimalPlaces: 2,
percentLocation: "middle",
}
```
# Methods
```javascript
// Sets the current comment value.
progressbar.setComment("Loading images...")
// Sets the current value out of the completeAt. Hitting the
// completeAt value will be 100%. so 10 here with a completeAt of 100 will be 10%.
progressbar.setValue(10)
```
# Events
These events will be included in the options argument of `new AsciiProgress`
```javascript
{
// Will execute upon creation of new AsciiProgress
onStart: function() {
console.log("The progress bar has been created.")
},
// Will execute every time setValue method is called.
onUpdate: function(value, completeAt, percent) {
console.log("The value has been updated.")
},
// When the progress bar reaches 100% this event is called.
onComplete: function () {
console.log("The progress bar has reached 100%")
}
}
```