浏览代码

Use flag to only start once.

Afshin Darian 8 年之前
父节点
当前提交
bfe4eb7edf
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/application/index.ts

+ 6 - 1
src/application/index.ts

@@ -41,6 +41,10 @@ class JupyterLab extends Application<ApplicationShell> {
    * Start the JupyterLab application.
    */
   start(options: Application.IStartOptions = {}): Promise<void> {
+    if (this._startedFlag) {
+      return Promise.resolve(void 0);
+    }
+    this._startedFlag = true;
     return super.start(options).then(() => { this._startedResolve(); });
   }
 
@@ -51,6 +55,7 @@ class JupyterLab extends Application<ApplicationShell> {
     return new ApplicationShell();
   }
 
-  private _startedResolve: () => void;
+  private _startedFlag = false;
   private _startedPromise: Promise<void> = null;
+  private _startedResolve: () => void = null;
 }