浏览代码

Add executed signal to console widget to indicate time of last prompt execution.

Afshin Darian 8 年之前
父节点
当前提交
3d695aaf90
共有 1 个文件被更改,包括 13 次插入1 次删除
  1. 13 1
      src/console/widget.ts

+ 13 - 1
src/console/widget.ts

@@ -6,7 +6,7 @@ import {
 } from 'jupyter-js-services';
 
 import {
-  clearSignalData
+  clearSignalData, defineSignal, ISignal
 } from 'phosphor/lib/core/signaling';
 
 import {
@@ -146,6 +146,12 @@ class ConsoleWidget extends Widget {
     });
   }
 
+  /**
+   * A signal emitted when the console executes its prompt.
+   */
+  executed: ISignal<ConsoleWidget, Date>;
+
+
   /**
    * Get the inspection handler used by the console.
    *
@@ -214,6 +220,7 @@ class ConsoleWidget extends Widget {
     this.newPrompt();
     return prompt.execute(this._session.kernel).then(
       (value: KernelMessage.IExecuteReplyMsg) => {
+        this.executed.emit(new Date());
         if (!value) {
           this._inspectionHandler.handleExecuteReply(null);
           return;
@@ -373,6 +380,11 @@ class ConsoleWidget extends Widget {
   private _session: ISession = null;
 }
 
+
+// Define the signals for the `ConsoleWidget` class.
+defineSignal(ConsoleWidget.prototype, 'executed');
+
+
 /**
  * A namespace for ConsoleWidget statics.
  */