@@ -3,49 +3,50 @@ import { CompositeDisposable } from 'atom';
33import client from '../connection/client' ;
44import { formatTimePeriod } from '../misc' ;
55
6- export default {
7- progs : { } ,
6+ export let progs = { }
87
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 ;
1213 client . handle ( { 'progress' : ( t , id , m ) => this [ t ] ( id , m ) } ) ;
1314 let status = [ ] ;
14- this . subs . add (
15+ subs . add (
1516 client . onWorking ( ( ) => {
16- return status = this . ink . progress . add ( null , { description : 'Julia' } ) ;
17+ return status = ink . progress . add ( null , { description : 'Julia' } ) ;
1718 } ) ,
1819 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 ( ) )
2122 ) ;
22- } ,
23+ }
2324
24- deactivate ( ) {
25- this . clear ( ) ;
26- this . subs . dispose ( ) ;
27- } ,
25+ export function deactivate ( ) {
26+ clear ( ) ;
27+ subs . dispose ( ) ;
28+ }
2829
29- add ( id ) {
30- const pr = this . ink . progress . add ( ) ;
30+ export function add ( id ) {
31+ const pr = ink . progress . add ( ) ;
3132 pr . t0 = Date . now ( ) ;
3233 pr . showTime = true ;
33- this . progs [ id ] = pr ;
34- } ,
34+ progs [ id ] = pr ;
35+ }
3536
36- progress ( id , prog ) {
37- const pr = this . progs [ id ] ;
37+ export function progress ( id , prog ) {
38+ const pr = progs [ id ] ;
3839 if ( pr == null ) { return ; }
3940 pr . level = prog ;
40- if ( pr . showTime ) { return this . rightText ( id , null ) ; }
41- } ,
41+ if ( pr . showTime ) { return rightText ( id , null ) ; }
42+ }
4243
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
4445
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
4647
47- rightText ( id , m ) {
48- const pr = this . progs [ id ] ;
48+ export function rightText ( id , m ) {
49+ const pr = progs [ id ] ;
4950 if ( pr == null ) { return ; }
5051 if ( m != null ? m . length : undefined ) {
5152 pr . rightText = m ;
@@ -55,23 +56,22 @@ export default {
5556 pr . showTime = true ;
5657 return pr . rightText = formatTimePeriod ( dt ) ;
5758 }
58- } ,
59+ }
5960
60- delete ( id ) {
61- const pr = this . progs [ id ] ;
61+ export function deleteit ( id ) {
62+ const pr = progs [ id ] ;
6263 if ( pr == null ) { return ; }
6364 pr . destroy ( ) ;
64- delete this . progs [ id ] ;
65- } ,
65+ delete progs [ id ] ;
66+ }
6667
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 [ _ ] ;
7071 if ( p != null ) {
7172 p . destroy ( ) ;
7273 }
7374 }
74- this . progs = { } ;
75- this . ink . progress . hide ( ) ;
76- }
77- } ;
75+ progs = { } ;
76+ ink . progress . hide ( ) ;
77+ }
0 commit comments