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> {
3232 return new TimelineStateProvider ( this , state , ipc ) ;
3333 }
3434 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 } ) ;
3636 }
3737
3838 override connectedCallback ( ) : void {
Original file line number Diff line number Diff line change @@ -165,10 +165,21 @@ export class HostIpc implements Disposable {
165165 return promise ;
166166 }
167167
168- setState < T > ( state : Partial < T > ) : void {
168+ setPersistedState < T > ( state : Partial < T > ) : void {
169169 this . _api . setState ( state ) ;
170170 }
171171
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+
172183 @debug < HostIpc [ 'postMessage' ] > ( { args : { 0 : e => `${ e . id } , method=${ e . method } ` } } )
173184 private postMessage ( e : IpcMessage ) {
174185 this . _api . postMessage ( e ) ;
You can’t perform that action at this time.
0 commit comments