File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 1
- <p align =" center " ><img width = " 230 " src =" https://cdn.jsdelivr.net/gh/keindev/tasktree/media/logo .svg " alt =" TaskTree logo" ></p >
1
+ <p align =" center " ><img src =" https://cdn.jsdelivr.net/gh/keindev/tasktree/media/banner .svg " alt =" Package logo" ></p >
2
2
3
3
<p align =" center " >
4
4
<a href="https://travis-ci.com/keindev/tasktree"><img src="https://travis-ci.com/keindev/tasktree.svg?branch=master" alt="Build Status"></a>
@@ -19,7 +19,7 @@ npm install tasktree-cli
19
19
20
20
## Usage
21
21
22
- ``` javascript
22
+ ``` typescript
23
23
import TaskTree from ' tasktree-cli' ;
24
24
25
25
const tree = TaskTree .tree ();
@@ -40,19 +40,23 @@ let once = false;
40
40
const promises = [50 , 75 , 200 ].map ((ms , i ) => {
41
41
return new Promise (resolve => {
42
42
const handle = setInterval (() => {
43
- if (once) {
44
- if (bars[i].percent >= 50 ) {
45
- bars[i].skip ();
43
+ const bar = bars [i ];
44
+
45
+ if (bar ) {
46
+ if (once ) {
47
+ if (bar .percent >= 50 ) {
48
+ bar .skip ();
49
+ } else {
50
+ bar .fail ();
51
+ }
46
52
} else {
47
- bars[i]. fail () ;
53
+ once = bar . tick ( Math . random () * 10 ). isCompleted ;
48
54
}
49
- } else {
50
- once = bars[i].tick (Math .random () * 10 ).isCompleted ;
51
55
}
52
56
53
57
if (once ) {
54
58
clearInterval (handle );
55
- resolve ();
59
+ resolve (' ' );
56
60
}
57
61
}, ms );
58
62
});
@@ -72,7 +76,7 @@ Promise.all(promises).then(() => {
72
76
73
77
TaskTree uses [ chalk-template] ( https://www.npmjs.com/package/chalk-template ) to style text and supports formatting as a [ tagged template literal] ( https://www.npmjs.com/package/chalk#tagged-template-literal ) .
74
78
75
- ``` javascript
79
+ ``` typescript
76
80
const task = new Task (' {underline.cyan.bold Awesome task}' );
77
81
```
78
82
You can’t perform that action at this time.
0 commit comments