File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 1
- import TaskTree from '../lib/index.js' ;
1
+ /* eslint-disable */
2
+ import TaskTree from '../src/TaskTree' ;
3
+
2
4
const tree = TaskTree . tree ( ) ;
3
5
4
6
// start task tree log update in terminal
@@ -17,19 +19,23 @@ let once = false;
17
19
const promises = [ 50 , 75 , 200 ] . map ( ( ms , i ) => {
18
20
return new Promise ( resolve => {
19
21
const handle = setInterval ( ( ) => {
20
- if ( once ) {
21
- if ( bars [ i ] . percent >= 50 ) {
22
- bars [ i ] . skip ( ) ;
22
+ const bar = bars [ i ] ;
23
+
24
+ if ( bar ) {
25
+ if ( once ) {
26
+ if ( bar . percent >= 50 ) {
27
+ bar . skip ( ) ;
28
+ } else {
29
+ bar . fail ( ) ;
30
+ }
23
31
} else {
24
- bars [ i ] . fail ( ) ;
32
+ once = bar . tick ( Math . random ( ) * 10 ) . isCompleted ;
25
33
}
26
- } else {
27
- once = bars [ i ] . tick ( Math . random ( ) * 10 ) . isCompleted ;
28
34
}
29
35
30
36
if ( once ) {
31
37
clearInterval ( handle ) ;
32
- resolve ( ) ;
38
+ resolve ( '' ) ;
33
39
}
34
40
} , ms ) ;
35
41
} ) ;
You can’t perform that action at this time.
0 commit comments