浏览代码

Clean up mime renderer

Steven Silvester 7 年之前
父节点
当前提交
ff8145dec7
共有 1 个文件被更改,包括 7 次插入9 次删除
  1. 7 9
      packages/docregistry/src/default.ts

+ 7 - 9
packages/docregistry/src/default.ts

@@ -427,12 +427,15 @@ class MimeRenderer extends Widget {
     context.pathChanged.connect(this._onPathChanged, this);
 
     this._context.ready.then(() => {
+      if (this.isDisposed) {
+        return;
+      }
       this._render();
 
       // Throttle the rendering rate of the widget.
       this._monitor = new ActivityMonitor({
         signal: context.model.contentChanged,
-        timeout: RENDER_TIMEOUT
+        timeout: options.renderTimeout
       });
       this._monitor.activityStopped.connect(this.update, this);
     });
@@ -452,7 +455,9 @@ class MimeRenderer extends Widget {
     if (this.isDisposed) {
       return;
     }
-    this._monitor.dispose();
+    if (this._monitor) {
+      this._monitor.dispose();
+    }
     super.dispose();
   }
 
@@ -464,13 +469,6 @@ class MimeRenderer extends Widget {
     this.node.focus();
   }
 
-  /**
-   * Handle an `after-attach` message to the widget.
-   */
-  protected onAfterAttach(msg: Message): void {
-    this.update();
-  }
-
   /**
    * Handle an `update-request` message to the widget.
    */