File tree 4 files changed +30
-22
lines changed
arduino-ide-extension/src
electron-browser/theia/core
4 files changed +30
-22
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import { BoardsDataStore } from './boards-data-store';
13
13
import { MainMenuManager } from '../../common/main-menu-manager' ;
14
14
import { ArduinoMenus , unregisterSubmenu } from '../menu/arduino-menus' ;
15
15
import { nls } from '@theia/core/lib/common' ;
16
+ import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state' ;
16
17
17
18
@injectable ( )
18
19
export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
@@ -31,11 +32,20 @@ export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
31
32
@inject ( BoardsServiceProvider )
32
33
protected readonly boardsServiceClient : BoardsServiceProvider ;
33
34
35
+ @inject ( FrontendApplicationStateService )
36
+ private readonly appStateService : FrontendApplicationStateService ;
37
+
34
38
protected readonly queue = new PQueue ( { autoStart : true , concurrency : 1 } ) ;
35
39
protected readonly toDisposeOnBoardChange = new DisposableCollection ( ) ;
36
40
37
41
async onStart ( ) : Promise < void > {
38
- this . updateMenuActions ( this . boardsServiceClient . boardsConfig . selectedBoard ) ;
42
+ this . appStateService
43
+ . reachedState ( 'ready' )
44
+ . then ( ( ) =>
45
+ this . updateMenuActions (
46
+ this . boardsServiceClient . boardsConfig . selectedBoard
47
+ )
48
+ ) ;
39
49
this . boardsDataStore . onChanged ( ( ) =>
40
50
this . updateMenuActions (
41
51
this . boardsServiceClient . boardsConfig . selectedBoard
Original file line number Diff line number Diff line change @@ -101,16 +101,14 @@ PID: ${PID}`;
101
101
}
102
102
103
103
override onStart ( ) : void {
104
- this . notificationCenter . onPlatformInstalled ( this . updateMenus . bind ( this ) ) ;
105
- this . notificationCenter . onPlatformUninstalled ( this . updateMenus . bind ( this ) ) ;
106
- this . boardsServiceProvider . onBoardsConfigChanged (
107
- this . updateMenus . bind ( this )
104
+ this . notificationCenter . onPlatformInstalled ( ( ) => this . updateMenus ( ) ) ;
105
+ this . notificationCenter . onPlatformUninstalled ( ( ) => this . updateMenus ( ) ) ;
106
+ this . boardsServiceProvider . onBoardsConfigChanged ( ( ) => this . updateMenus ( ) ) ;
107
+ this . boardsServiceProvider . onAvailableBoardsChanged ( ( ) =>
108
+ this . updateMenus ( )
108
109
) ;
109
- this . boardsServiceProvider . onAvailableBoardsChanged (
110
- this . updateMenus . bind ( this )
111
- ) ;
112
- this . boardsServiceProvider . onAvailablePortsChanged (
113
- this . updateMenus . bind ( this )
110
+ this . boardsServiceProvider . onAvailablePortsChanged ( ( ) =>
111
+ this . updateMenus ( )
114
112
) ;
115
113
}
116
114
Original file line number Diff line number Diff line change @@ -18,16 +18,16 @@ export class ElectronMenuContribution
18
18
@inject ( FrontendApplicationStateService )
19
19
private readonly appStateService : FrontendApplicationStateService ;
20
20
21
- private appReady = false ;
22
- private updateWhenReady = false ;
21
+ // private appReady = false;
22
+ // private updateWhenReady = false;
23
23
24
24
override onStart ( app : FrontendApplication ) : void {
25
25
super . onStart ( app ) ;
26
26
this . appStateService . reachedState ( 'ready' ) . then ( ( ) => {
27
- this . appReady = true ;
28
- if ( this . updateWhenReady ) {
29
- this . update ( ) ;
30
- }
27
+ // this.appReady = true;
28
+ // if (this.updateWhenReady) {
29
+ // this.update();
30
+ // }
31
31
} ) ;
32
32
}
33
33
@@ -37,11 +37,11 @@ export class ElectronMenuContribution
37
37
}
38
38
39
39
update ( ) : void {
40
- if ( this . appReady ) {
41
- ( this as any ) . setMenu ( ) ;
42
- } else {
43
- this . updateWhenReady = true ;
44
- }
40
+ ( this as any ) . setMenu ( ) ;
41
+ // if (this.appReady) {
42
+ // } else {
43
+ // this.updateWhenReady = true;
44
+ // }
45
45
}
46
46
47
47
override registerCommands ( registry : CommandRegistry ) : void {
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export class ArduinoDaemonImpl
41
41
// Backend application lifecycle.
42
42
43
43
onStart ( ) : void {
44
- this . startDaemon ( ) ;
44
+ this . startDaemon ( ) ; // no await
45
45
}
46
46
47
47
// Daemon API
You can’t perform that action at this time.
0 commit comments