phosphorjs / phosphor

The PhosphorJS Library
BSD 3-Clause "New" or "Revised" License
1.04k stars 166 forks source link

Save layouts to local file and restore them #434

Closed martaszmit closed 4 years ago

martaszmit commented 4 years ago

Hi, is it possible to save layout to local file ( .txt? maybe different) and then 'load' it from this file and restore it?

afshin commented 4 years ago

Hi @martaszmit! Yes, this is exactly what JupyterLab's layout restoration logic does. The life cycle is described here: https://github.com/jupyterlab/jupyterlab/blob/master/packages/application/src/layoutrestorer.ts#L67-L115

The save() method in the connector returns a promise, so it could be writing to disk or speaking to an external API.