File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export class GlTimelineApp extends GlApp<State> {
32
32
return new TimelineStateProvider ( this , state , ipc ) ;
33
33
}
34
34
protected override onPersistState ( state : State ) : void {
35
- this . _ipc . setState ( { period : state . period , uri : state . uri } ) ;
35
+ this . _ipc . setPersistedState ( { period : state . period , uri : state . uri } ) ;
36
36
}
37
37
38
38
override connectedCallback ( ) : void {
Original file line number Diff line number Diff line change @@ -165,10 +165,21 @@ export class HostIpc implements Disposable {
165
165
return promise ;
166
166
}
167
167
168
- setState < T > ( state : Partial < T > ) : void {
168
+ setPersistedState < T > ( state : Partial < T > ) : void {
169
169
this . _api . setState ( state ) ;
170
170
}
171
171
172
+ updatePersistedState < T > ( update : Partial < T > ) : void {
173
+ let state = this . _api . getState ( ) as Partial < T > | undefined ;
174
+ if ( state != null && typeof state === 'object' ) {
175
+ state = { ...state , ...update } ;
176
+ this . _api . setState ( state ) ;
177
+ } else {
178
+ state = update ;
179
+ }
180
+ this . setPersistedState ( state ) ;
181
+ }
182
+
172
183
@debug < HostIpc [ 'postMessage' ] > ( { args : { 0 : e => `${ e . id } , method=${ e . method } ` } } )
173
184
private postMessage ( e : IpcMessage ) {
174
185
this . _api . postMessage ( e ) ;
You can’t perform that action at this time.
0 commit comments