@@ -18,6 +18,10 @@ import {
18
18
Config ,
19
19
Sketch ,
20
20
} from '../common/protocol' ;
21
+ import {
22
+ FrontendApplicationStateService ,
23
+ FrontendApplicationState ,
24
+ } from '@theia/core/lib/browser/frontend-application-state' ;
21
25
22
26
@injectable ( )
23
27
export class NotificationCenter
@@ -26,6 +30,9 @@ export class NotificationCenter
26
30
@inject ( NotificationServiceServer )
27
31
protected readonly server : JsonRpcProxy < NotificationServiceServer > ;
28
32
33
+ @inject ( FrontendApplicationStateService )
34
+ private readonly appStateService : FrontendApplicationStateService ;
35
+
29
36
protected readonly indexUpdatedEmitter = new Emitter < void > ( ) ;
30
37
protected readonly daemonStartedEmitter = new Emitter < string > ( ) ;
31
38
protected readonly daemonStoppedEmitter = new Emitter < void > ( ) ;
@@ -49,6 +56,8 @@ export class NotificationCenter
49
56
protected readonly recentSketchesChangedEmitter = new Emitter < {
50
57
sketches : Sketch [ ] ;
51
58
} > ( ) ;
59
+ private readonly onAppStateDidChangeEmitter =
60
+ new Emitter < FrontendApplicationState > ( ) ;
52
61
53
62
protected readonly toDispose = new DisposableCollection (
54
63
this . indexUpdatedEmitter ,
@@ -72,10 +81,16 @@ export class NotificationCenter
72
81
readonly onLibraryUninstalled = this . libraryUninstalledEmitter . event ;
73
82
readonly onAttachedBoardsChanged = this . attachedBoardsChangedEmitter . event ;
74
83
readonly onRecentSketchesChanged = this . recentSketchesChangedEmitter . event ;
84
+ readonly onAppStateDidChange = this . onAppStateDidChangeEmitter . event ;
75
85
76
86
@postConstruct ( )
77
87
protected init ( ) : void {
78
88
this . server . setClient ( this ) ;
89
+ this . toDispose . push (
90
+ this . appStateService . onStateChanged ( ( state ) =>
91
+ this . onAppStateDidChangeEmitter . fire ( state )
92
+ )
93
+ ) ;
79
94
}
80
95
81
96
onStop ( ) : void {
0 commit comments