|
@@ -134,8 +134,14 @@ export class CodeConsole extends Widget {
|
|
|
});
|
|
|
|
|
|
this._onKernelChanged();
|
|
|
- this.session.kernelChanged.connect(this._onKernelChanged, this);
|
|
|
- this.session.statusChanged.connect(this._onKernelStatusChanged, this);
|
|
|
+ this.session.kernelChanged.connect(
|
|
|
+ this._onKernelChanged,
|
|
|
+ this
|
|
|
+ );
|
|
|
+ this.session.statusChanged.connect(
|
|
|
+ this._onKernelStatusChanged,
|
|
|
+ this
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -212,7 +218,10 @@ export class CodeConsole extends Widget {
|
|
|
this._msgIds.set(msgId, cell);
|
|
|
this._msgIdCells.set(cell, msgId);
|
|
|
}
|
|
|
- cell.disposed.connect(this._onCellDisposed, this);
|
|
|
+ cell.disposed.connect(
|
|
|
+ this._onCellDisposed,
|
|
|
+ this
|
|
|
+ );
|
|
|
this.update();
|
|
|
}
|
|
|
|
|
@@ -224,7 +233,10 @@ export class CodeConsole extends Widget {
|
|
|
// An old banner just becomes a normal cell now.
|
|
|
let cell = this._banner;
|
|
|
this._cells.push(this._banner);
|
|
|
- cell.disposed.connect(this._onCellDisposed, this);
|
|
|
+ cell.disposed.connect(
|
|
|
+ this._onCellDisposed,
|
|
|
+ this
|
|
|
+ );
|
|
|
}
|
|
|
// Create the banner.
|
|
|
let model = this.modelFactory.createRawCell({});
|
|
@@ -340,10 +352,8 @@ export class CodeConsole extends Widget {
|
|
|
inject(code: string, metadata: JSONObject = {}): Promise<void> {
|
|
|
let cell = this.createCodeCell();
|
|
|
cell.model.value.text = code;
|
|
|
- if (metadata) {
|
|
|
- for (let key in metadata) {
|
|
|
- cell.model.metadata.set(key, metadata[key]);
|
|
|
- }
|
|
|
+ for (let key of Object.keys(metadata)) {
|
|
|
+ cell.model.metadata.set(key, metadata[key]);
|
|
|
}
|
|
|
this.addCell(cell);
|
|
|
return this._execute(cell);
|
|
@@ -642,7 +652,10 @@ export class CodeConsole extends Widget {
|
|
|
this.clear();
|
|
|
return Promise.resolve(void 0);
|
|
|
}
|
|
|
- cell.model.contentChanged.connect(this.update, this);
|
|
|
+ cell.model.contentChanged.connect(
|
|
|
+ this.update,
|
|
|
+ this
|
|
|
+ );
|
|
|
let onSuccess = (value: KernelMessage.IExecuteReplyMsg) => {
|
|
|
if (this.isDisposed) {
|
|
|
return;
|