@@ -6,7 +6,7 @@ import { PageConfig } from '@jupyterlab/coreutils';
66import { DocumentRegistry } from '@jupyterlab/docregistry' ;
77
88import { ArrayExt , find } from '@lumino/algorithm' ;
9- import { Token } from '@lumino/coreutils' ;
9+ import { PromiseDelegate , Token } from '@lumino/coreutils' ;
1010import { Message , MessageLoop , IMessageHandler } from '@lumino/messaging' ;
1111import { Debouncer } from '@lumino/polling' ;
1212import { ISignal , Signal } from '@lumino/signaling' ;
@@ -75,12 +75,10 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
7575 } else {
7676 this . layout = this . initLayoutWithoutSidePanels ( ) ;
7777 }
78-
7978 }
8079
8180 initLayoutWithoutSidePanels ( ) : Layout {
8281 const rootLayout = new BoxLayout ( ) ;
83-
8482 BoxLayout . setStretch ( this . _main , 1 ) ;
8583
8684 this . _spacer = new Widget ( ) ;
@@ -211,6 +209,13 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
211209 return ! ( this . _rightHandler . isVisible && this . rightPanel . isVisible ) ;
212210 }
213211
212+ /**
213+ * Promise that resolves when main widget is loaded
214+ */
215+ get restored ( ) : Promise < void > {
216+ return this . _mainWidgetLoaded . promise ;
217+ }
218+
214219 /**
215220 * Activate a widget in its area.
216221 */
@@ -259,6 +264,7 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
259264 this . _main . addWidget ( widget ) ;
260265 this . _main . update ( ) ;
261266 this . _currentChanged . emit ( void 0 ) ;
267+ this . _mainWidgetLoaded . resolve ( ) ;
262268 break ;
263269 case 'left' :
264270 if ( this . sidePanelsVisible ( ) ) {
@@ -382,15 +388,6 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
382388 }
383389 }
384390
385- /**
386- * Return the list of widgets for the given area.
387- *
388- * @param area The area
389- */
390- // widgets(area?: string): IIterator<Widget> {
391- // return iter(this.widgetsList(area));
392- // }
393-
394391 /**
395392 * Is a particular area empty (no widgets)?
396393 *
@@ -430,6 +427,7 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
430427 private _spacer : Widget ;
431428 private _main : Panel ;
432429 private _currentChanged = new Signal < this, void > ( this ) ;
430+ private _mainWidgetLoaded = new PromiseDelegate < void > ( ) ;
433431}
434432
435433/**
0 commit comments