Skip to content

Commit 86241b2

Browse files
authored
Update for JupyterLab 2 and 3
Updated so that it works with JuptyerLab 2 and 3
1 parent 9424339 commit 86241b2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

labextension/vpython/src/index.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
IDisposable, DisposableDelegate
3-
} from '@phosphor/disposable';
3+
} from '@lumino/disposable';
44

55
import {
66
JupyterFrontEnd, JupyterFrontEndPlugin
@@ -35,13 +35,15 @@ class VPythonExtension implements DocumentRegistry.IWidgetExtension<NotebookPane
3535
*/
3636
createNew(panel: NotebookPanel, context: DocumentRegistry.IContext<INotebookModel>): IDisposable {
3737

38-
Promise.all([panel.revealed, panel.session.ready, context.ready]).then(function() {
39-
const session = context.session;
38+
//Promise.all([panel.revealed, panel.sessionContext.ready, context.ready]).then(function() {
39+
// sessionContext: ISessionContext
40+
Promise.all([panel.revealed, panel.sessionContext.ready, context.ready]).then(function() {
41+
const session = context.sessionContext.session;
4042
const kernelInstance = session.kernel;
4143
(<any>window).JLab_VPython = true;
4244

43-
try {
44-
kernelInstance.registerCommTarget('glow', (vp_comm, commMsg) => {
45+
try {
46+
kernelInstance.registerCommTarget('glow', (vp_comm: any, commMsg: any) => {
4547
// Use Dynamic import() Expression to import glowcomm when comm is opened
4648
import("./glowcommlab").then(glowcommlab => {
4749
glowcommlab.comm = vp_comm
@@ -56,7 +58,7 @@ class VPythonExtension implements DocumentRegistry.IWidgetExtension<NotebookPane
5658
glowcommlab.setupWebsocket(commMsg, serviceUrl)
5759
});
5860

59-
vp_comm.onClose = (msg) => {console.log("comm onClose");};
61+
vp_comm.onClose = (msg: any) => {console.log("comm onClose");};
6062
});
6163
}
6264
catch(err) {

0 commit comments

Comments
 (0)