Browse Source

Use phosphor promisedelegate

Steven Silvester 8 years ago
parent
commit
79b01b48b1
3 changed files with 20 additions and 47 deletions
  1. 7 30
      src/application/shell.ts
  2. 5 5
      src/docregistry/context.ts
  3. 8 12
      src/instancerestorer/instancerestorer.ts

+ 7 - 30
src/application/shell.ts

@@ -1,44 +1,21 @@
 // Copyright (c) Jupyter Development Team.
 // Distributed under the terms of the Modified BSD License.
 
-import {
-  utils
-} from '@jupyterlab/services';
-
 import {
   ArrayExt, each, find, toArray
 } from '@phosphor/algorithm';
 
 import {
-  ISignal, Signal
-} from '@phosphor/signaling';
-
-import {
-  BoxLayout, BoxPanel
-} from '@phosphor/widgets';
-
-import {
-  DockPanel
-} from '@phosphor/widgets';
-
-import {
-  FocusTracker
-} from '@phosphor/widgets';
-
-import {
-  Panel
-} from '@phosphor/widgets';
+  PromiseDelegate
+} from '@phosphor/coreutils';
 
 import {
-  SplitPanel
-} from '@phosphor/widgets';
-
-import {
-  StackedPanel
-} from '@phosphor/widgets';
+  ISignal, Signal
+} from '@phosphor/signaling';
 
 import {
-  TabBar, Title, Widget
+  BoxLayout, BoxPanel, DockPanel, FocusTracker, Panel, SplitPanel,
+  StackedPanel, TabBar, Title, Widget
 } from '@phosphor/widgets';
 
 import {
@@ -503,7 +480,7 @@ class ApplicationShell extends Widget {
   private _hsplitPanel: SplitPanel;
   private _isRestored = false;
   private _leftHandler: Private.SideBarHandler;
-  private _restored = new utils.PromiseDelegate<IInstanceRestorer.ILayout>();
+  private _restored = new PromiseDelegate<IInstanceRestorer.ILayout>();
   private _rightHandler: Private.SideBarHandler;
   private _topPanel: Panel;
   private _tracker = new FocusTracker<Widget>();

+ 5 - 5
src/docregistry/context.ts

@@ -5,14 +5,14 @@ import {
   ContentsManager, Contents, Kernel, ServiceManager, Session, utils
 } from '@jupyterlab/services';
 
-import {
-  JSONObject
-} from '@phosphor/coreutils';
-
 import {
   ArrayExt
 } from '@phosphor/algorithm';
 
+import {
+  JSONObject, PromiseDelegate
+} from '@phosphor/coreutils';
+
 import {
   IDisposable, DisposableDelegate
 } from '@phosphor/disposable';
@@ -544,7 +544,7 @@ class Context<T extends DocumentRegistry.IModel> implements DocumentRegistry.ICo
   private _factory: DocumentRegistry.IModelFactory<T> = null;
   private _contentsModel: Contents.IModel = null;
   private _readyPromise: Promise<void>;
-  private _populatedPromise = new utils.PromiseDelegate<void>();
+  private _populatedPromise = new PromiseDelegate<void>();
   private _isPopulated = false;
   private _isReady = false;
   private _kernelChanged = new Signal<this, Kernel.IKernel>(this);

+ 8 - 12
src/instancerestorer/instancerestorer.ts

@@ -4,29 +4,25 @@
 |----------------------------------------------------------------------------*/
 
 import {
-  utils
-} from '@jupyterlab/services';
+  Token
+} from '@phosphor/application';
 
 import {
-  JSONObject
+  CommandRegistry
+} from '@phosphor/commands';
+
+import {
+  JSONObject, PromiseDelegate
 } from '@phosphor/coreutils';
 
 import {
   AttachedProperty
 } from '@phosphor/properties';
 
-import {
-  CommandRegistry
-} from '@phosphor/commands';
-
 import {
   Widget
 } from '@phosphor/widgets';
 
-import {
-  Token
-} from '@phosphor/application';
-
 import {
   InstanceTracker
 } from '../common/instancetracker';
@@ -425,7 +421,7 @@ class InstanceRestorer implements IInstanceRestorer {
 
   private _first: Promise<any> = null;
   private _promises: Promise<any>[] = [];
-  private _restored = new utils.PromiseDelegate<void>();
+  private _restored = new PromiseDelegate<void>();
   private _registry: CommandRegistry = null;
   private _state: IStateDB = null;
   private _trackers = new Set<string>();