Kaynağa Gözat

Modernize InspectorHandler.

Afshin Darian 8 yıl önce
ebeveyn
işleme
74b16b25d1
1 değiştirilmiş dosya ile 25 ekleme ve 53 silme
  1. 25 53
      src/inspector/handler.ts

+ 25 - 53
src/inspector/handler.ts

@@ -7,24 +7,20 @@ import {
 
 import {
   IDisposable
-} from 'phosphor-disposable';
+} from 'phosphor/lib/core/disposable';
 
 import {
-  ISignal, Signal, clearSignalData
-} from 'phosphor-signaling';
+  clearSignalData, defineSignal, ISignal
+} from 'phosphor/lib/core/signaling';
 
 import {
-  Widget
-} from 'phosphor-widget';
+  CellEditorWidget, ITextChange
+} from '../notebook/cells/editor';
 
 import {
   BaseCellWidget
 } from '../notebook/cells/widget';
 
-import {
-  CellEditorWidget, ITextChange
-} from '../notebook/cells/editor';
-
 import {
   RenderMime
 } from '../rendermime';
@@ -46,6 +42,21 @@ class InspectionHandler implements IDisposable, Inspector.IInspectable {
     this._rendermime = rendermime;
   }
 
+  /**
+   * A signal emitted when the handler is disposed.
+   */
+  disposed: ISignal<InspectionHandler, void>;
+
+  /**
+   * A signal emitted when inspector should clear all items with no history.
+   */
+  ephemeralCleared: ISignal<InspectionHandler, void>;
+
+  /**
+   * A signal emitted when an inspector value is generated.
+   */
+  inspected: ISignal<InspectionHandler, Inspector.IInspectorUpdate>;
+
   /**
    * The cell widget used by the inspection handler.
    */
@@ -63,7 +74,7 @@ class InspectionHandler implements IDisposable, Inspector.IInspectable {
     this._activeCell = newValue;
     if (this._activeCell) {
       // Clear ephemeral inspectors in preparation for a new editor.
-      this.clearEphemeral.emit(void 0);
+      this.ephemeralCleared.emit(void 0);
       this._activeCell.editor.textChanged.connect(this.onTextChanged, this);
     }
   }
@@ -78,27 +89,6 @@ class InspectionHandler implements IDisposable, Inspector.IInspectable {
     this._kernel = value;
   }
 
-  /**
-   * A signal emitted when inspector should clear all items with no history.
-   */
-  get clearEphemeral(): ISignal<InspectionHandler, void> {
-    return Private.clearEphemeralSignal.bind(this);
-  }
-
-  /**
-   * A signal emitted when the handler is disposed.
-   */
-  get disposed(): ISignal<InspectionHandler, void> {
-    return Private.disposedSignal.bind(this);
-  }
-
-  /**
-   * A signal emitted when an inspector value is generated.
-   */
-  get inspected(): ISignal<InspectionHandler, Inspector.IInspectorUpdate> {
-    return Private.inspectedSignal.bind(this);
-  }
-
   /**
    * Get whether the inspection handler is disposed.
    *
@@ -214,25 +204,7 @@ class InspectionHandler implements IDisposable, Inspector.IInspectable {
 }
 
 
-/**
- * A namespace for inspector handler private data.
- */
-namespace Private {
-  /**
-   * A signal emitted when inspector should clear all items with no history.
-   */
-  export
-  const clearEphemeralSignal = new Signal<InspectionHandler, void>();
-
-  /**
-   * A signal emitted when the handler is disposed.
-   */
-  export
-  const disposedSignal = new Signal<InspectionHandler, void>();
-
-  /**
-   * A signal emitted when an inspector value is generated.
-   */
-  export
-  const inspectedSignal = new Signal<InspectionHandler, Inspector.IInspectorUpdate>();
-}
+// Define the signals for the `FileBrowserModel` class.
+defineSignal(InspectionHandler.prototype, 'ephemeralCleared');
+defineSignal(InspectionHandler.prototype, 'disposed');
+defineSignal(InspectionHandler.prototype, 'inspected');