You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<palign="center">Fork from <ahref="https://github.com/tsayen/dom-to-image"rel="nofollow">dom-to-image</a> with more maintainable code and some new features.</p>
> For more usage see the [examples](https://github.com/bubkoo/ascii-progress/blob/master/examples)
29
34
30
35
```javascript
31
-
varProgressBar =require('ascii-progress');
36
+
const { ProgressBar }=require('ascii-progress');
32
37
33
-
var bar =newProgressBar({
38
+
constbar=newProgressBar({
34
39
schema:':bar',
35
-
total :10
40
+
total :10,
36
41
});
37
42
38
-
var iv =setInterval(function () {
43
+
constiv=setInterval(function () {
39
44
bar.tick();
40
45
if (bar.completed) {
41
46
clearInterval(iv);
@@ -46,9 +51,7 @@ var iv = setInterval(function () {
46
51
47
52
### Options
48
53
49
-
These are keys in the options object you can pass to the progress bar along with
50
-
`total` as seen in the example above.
51
-
54
+
These are keys in the options object you can pass to the progress bar along with `total` as seen in the example above.
52
55
53
56
-`schema` - template string of the progress bar. Default `" [:bar] :current/:total :percent :elapseds :etas'"`.
54
57
-`total` - total number of ticks to complete. Default `100`.
@@ -62,35 +65,22 @@ These are keys in the options object you can pass to the progress bar along with
62
65
63
66
64
67
### Properties
65
-
66
68
-`schema`
67
69
-`total`
68
70
-`current`
69
71
-`completed`
70
72
71
73
### Methods
72
74
73
-
#### `setSchema(schema, refresh/tokens)`
74
-
75
-
Update the schema of the progress bar. If `refresh` or `tokens` is truely the progress bar will be refreshed.
76
-
77
-
#### `tick(delta, tokens)`
78
-
79
-
Update ticks of the progress bar by `delta`, then render the progress bar with optional `tokens`.
80
-
81
-
#### `update(ratio, tokens)`
82
-
83
-
Update the progress bar to `ratio` by percentage, then render the progress bar with optional `tokens`.
84
-
85
-
#### `clear()`
86
-
87
-
Clean the progress bar in the terminal.
75
+
-`setSchema(schema, refresh/tokens)` - Update the schema of the progress bar. If `refresh` or `tokens` is truely the progress bar will be refreshed.
76
+
-`tick(delta, tokens)` - Update ticks of the progress bar by `delta`, then render the progress bar with optional `tokens`.
77
+
-`update(ratio, tokens)` - Update the progress bar to `ratio` by percentage, then render the progress bar with optional `tokens`.
88
78
79
+
-`clear()` - Clean the progress bar in the terminal.
89
80
90
81
## Schema
91
82
92
-
The schema defines appearance the progress bar. Few inner tokens and many
93
-
formatting methods can be used to customer you progress bar.
83
+
The schema defines appearance the progress bar. Few inner tokens and many formatting methods can be used to customer you progress bar.
94
84
95
85
### Tokens
96
86
@@ -110,9 +100,9 @@ These are tokens you can use in the format of your progress bar.
110
100
You can define custom tokens by adding a `{name: value}` object parameter to your method (`tick()`, `update()`, etc.) calls.
111
101
112
102
```javascript
113
-
var bar =newProgressBar({
103
+
constbar=newProgressBar({
114
104
schema:':current: :token1 :token2',
115
-
total :3
105
+
total :3,
116
106
});
117
107
bar.tick({
118
108
'token1':"Hello",
@@ -207,7 +197,15 @@ The percentage is green and bold.
207
197
208
198
## Contributing
209
199
210
-
Pull requests and stars are highly welcome.
200
+
Please let us know how can we help. Do check out [issues](https://github.com/bubkoo/ascii-progress/issues) for bug reports or suggestions first.
201
+
202
+
To become a contributor, please follow our [contributing guide](/CONTRIBUTING.md).
0 commit comments