@@ -6,7 +6,7 @@ import { PageConfig } from '@jupyterlab/coreutils';
6
6
import { DocumentRegistry } from '@jupyterlab/docregistry' ;
7
7
8
8
import { ArrayExt , find , IIterator , iter } from '@lumino/algorithm' ;
9
- import { Token } from '@lumino/coreutils' ;
9
+ import { PromiseDelegate , Token } from '@lumino/coreutils' ;
10
10
import { Message , MessageLoop , IMessageHandler } from '@lumino/messaging' ;
11
11
import { Debouncer } from '@lumino/polling' ;
12
12
import { ISignal , Signal } from '@lumino/signaling' ;
@@ -75,12 +75,10 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
75
75
} else {
76
76
this . layout = this . initLayoutWithoutSidePanels ( ) ;
77
77
}
78
-
79
78
}
80
79
81
80
initLayoutWithoutSidePanels ( ) : Layout {
82
81
const rootLayout = new BoxLayout ( ) ;
83
-
84
82
BoxLayout . setStretch ( this . _main , 1 ) ;
85
83
86
84
this . _spacer = new Widget ( ) ;
@@ -211,6 +209,13 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
211
209
return ! ( this . _rightHandler . isVisible && this . rightPanel . isVisible ) ;
212
210
}
213
211
212
+ /**
213
+ * Promise that resolves when main widget is loaded
214
+ */
215
+ get restored ( ) : Promise < void > {
216
+ return this . _mainWidgetLoaded . promise ;
217
+ }
218
+
214
219
/**
215
220
* Activate a widget in its area.
216
221
*/
@@ -259,6 +264,7 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
259
264
this . _main . addWidget ( widget ) ;
260
265
this . _main . update ( ) ;
261
266
this . _currentChanged . emit ( void 0 ) ;
267
+ this . _mainWidgetLoaded . resolve ( ) ;
262
268
break ;
263
269
case 'left' :
264
270
if ( this . sidePanelsVisible ( ) ) {
@@ -410,6 +416,7 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
410
416
private _spacer : Widget ;
411
417
private _main : Panel ;
412
418
private _currentChanged = new Signal < this, void > ( this ) ;
419
+ private _mainWidgetLoaded = new PromiseDelegate < void > ( ) ;
413
420
}
414
421
415
422
/**
0 commit comments