Reputation: 11
according to golden layout documentation for saving and load state is something like that:
myLayout.on( 'stateChanged', function(){
var state = JSON.stringify( myLayout.toConfig() );
localStorage.setItem( 'savedState', state );
});
var myLayout,
savedState = localStorage.getItem( 'savedState' );
if( savedState !== null ) {
myLayout = new GoldenLayout( JSON.parse( savedState ) );
} else {
myLayout = new GoldenLayout( config );
}
but this is usefull for the version lower 1.5.9 if you try this in 2.6 you have to a runtime error something like this
app.routes.ts:9 ERROR TypeError: value.trimStart is not a function
at splitStringAtFirstNonNumericChar (utils.js:12:17)
at parseSize (config.js:856:7)
at Object.resolveSize (config.js:62:14)
at Object.resolve (config.js:232:20)
at Object.resolve (config.js:19:32)
at Object.resolve (config.js:542:33)
at Object.resolve (config.js:716:30)
at GoldenLayout.init (layout-manager.js:251:42)
at GoldenLayout.init (virtual-layout.js:92:11)
at _LayoutComponent.ngAfterViewInit (layout.component.ts:53:23)
and idk what is a posible solution for this or is not is posible because i see that golden layout has´nt a good maintenance.
save the state, actually try golden layout with angular i saw a dependency for react called flex layout and this work fine about the save state.
This is a minimal code for where i replied the error. stackblitz code
Upvotes: 1
Views: 34