@@ -3,49 +3,50 @@ import { CompositeDisposable } from 'atom';
3
3
import client from '../connection/client' ;
4
4
import { formatTimePeriod } from '../misc' ;
5
5
6
- export default {
7
- progs : { } ,
6
+ export let progs = { }
8
7
9
- activate ( ink ) {
10
- this . subs = new CompositeDisposable ;
11
- this . ink = ink ;
8
+ let subs ;
9
+ let ink ;
10
+ export function activate ( ink_in ) {
11
+ subs = new CompositeDisposable ;
12
+ ink = ink_in ;
12
13
client . handle ( { 'progress' : ( t , id , m ) => this [ t ] ( id , m ) } ) ;
13
14
let status = [ ] ;
14
- this . subs . add (
15
+ subs . add (
15
16
client . onWorking ( ( ) => {
16
- return status = this . ink . progress . add ( null , { description : 'Julia' } ) ;
17
+ return status = ink . progress . add ( null , { description : 'Julia' } ) ;
17
18
} ) ,
18
19
client . onDone ( ( ) => ( status != null ? status . destroy ( ) : undefined ) ) , // status?.destroy()
19
- client . onAttached ( ( ) => this . ink . progress . show ( ) ) ,
20
- client . onDetached ( ( ) => this . clear ( ) )
20
+ client . onAttached ( ( ) => ink . progress . show ( ) ) ,
21
+ client . onDetached ( ( ) => clear ( ) )
21
22
) ;
22
- } ,
23
+ }
23
24
24
- deactivate ( ) {
25
- this . clear ( ) ;
26
- this . subs . dispose ( ) ;
27
- } ,
25
+ export function deactivate ( ) {
26
+ clear ( ) ;
27
+ subs . dispose ( ) ;
28
+ }
28
29
29
- add ( id ) {
30
- const pr = this . ink . progress . add ( ) ;
30
+ export function add ( id ) {
31
+ const pr = ink . progress . add ( ) ;
31
32
pr . t0 = Date . now ( ) ;
32
33
pr . showTime = true ;
33
- this . progs [ id ] = pr ;
34
- } ,
34
+ progs [ id ] = pr ;
35
+ }
35
36
36
- progress ( id , prog ) {
37
- const pr = this . progs [ id ] ;
37
+ export function progress ( id , prog ) {
38
+ const pr = progs [ id ] ;
38
39
if ( pr == null ) { return ; }
39
40
pr . level = prog ;
40
- if ( pr . showTime ) { return this . rightText ( id , null ) ; }
41
- } ,
41
+ if ( pr . showTime ) { return rightText ( id , null ) ; }
42
+ }
42
43
43
- message ( id , m ) { return ( this . progs [ id ] != null ? this . progs [ id ] . message = m : undefined ) ; } , // this. progs[id]?.message = m
44
+ export function message ( id , m ) { return ( progs [ id ] != null ? progs [ id ] . message = m : undefined ) ; } , // progs[id]?.message = m
44
45
45
- leftText ( id , m ) { return ( this . progs [ id ] != null ? this . progs [ id ] . description = m : undefined ) ; } , // this. progs[id]?.description = m
46
+ export function leftText ( id , m ) { return ( progs [ id ] != null ? progs [ id ] . description = m : undefined ) ; } , // progs[id]?.description = m
46
47
47
- rightText ( id , m ) {
48
- const pr = this . progs [ id ] ;
48
+ export function rightText ( id , m ) {
49
+ const pr = progs [ id ] ;
49
50
if ( pr == null ) { return ; }
50
51
if ( m != null ? m . length : undefined ) {
51
52
pr . rightText = m ;
@@ -55,23 +56,22 @@ export default {
55
56
pr . showTime = true ;
56
57
return pr . rightText = formatTimePeriod ( dt ) ;
57
58
}
58
- } ,
59
+ }
59
60
60
- delete ( id ) {
61
- const pr = this . progs [ id ] ;
61
+ export function deleteit ( id ) {
62
+ const pr = progs [ id ] ;
62
63
if ( pr == null ) { return ; }
63
64
pr . destroy ( ) ;
64
- delete this . progs [ id ] ;
65
- } ,
65
+ delete progs [ id ] ;
66
+ }
66
67
67
- clear ( ) {
68
- for ( let _ in this . progs ) {
69
- const p = this . progs [ _ ] ;
68
+ export function clear ( ) {
69
+ for ( let _ in progs ) {
70
+ const p = progs [ _ ] ;
70
71
if ( p != null ) {
71
72
p . destroy ( ) ;
72
73
}
73
74
}
74
- this . progs = { } ;
75
- this . ink . progress . hide ( ) ;
76
- }
77
- } ;
75
+ progs = { } ;
76
+ ink . progress . hide ( ) ;
77
+ }
0 commit comments