Skip to content

Commit 73e4166

Browse files
committed
Make handleCommOpen a single function which captures this so it can be deregistered easily.
1 parent f6b83c2 commit 73e4166

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/jupyterlab-manager/src/manager.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,15 @@ export abstract class LabWidgetManager extends ManagerBase<Widget>
433433
return serialize_state(models, options);
434434
}
435435

436-
protected async _handleCommOpen(
436+
// _handleCommOpen is an attribute, not a method, so `this` is captured in a
437+
// single object that can be registered and removed
438+
protected _handleCommOpen = async (
437439
comm: Kernel.IComm,
438440
msg: KernelMessage.ICommOpenMsg
439-
): Promise<void> {
441+
): Promise<void> => {
440442
const oldComm = new shims.services.Comm(comm);
441443
await this.handle_comm_open(oldComm, msg);
442-
}
444+
};
443445

444446
protected _restored = new Signal<this, void>(this);
445447
protected _restoredStatus = false;

0 commit comments

Comments
 (0)