@fails-components/jupyter-interceptor 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +3 -3
- package/lib/index.js +4 -0
- package/package.json +3 -3
- package/src/index.ts +7 -3
package/lib/index.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export declare class AppletWidgetRegistry implements IAppletWidgetRegistry {
|
|
|
7
7
|
registerModel(path: string, modelId: string, model: WidgetModel): void;
|
|
8
8
|
unregisterPath(path: string): void;
|
|
9
9
|
unregisterModel(modelId: string): void;
|
|
10
|
-
getModelId(path: string): string;
|
|
11
|
-
getModel(path: string): WidgetModel;
|
|
12
|
-
getPath(modelId: string): string;
|
|
10
|
+
getModelId(path: string): string | undefined;
|
|
11
|
+
getModel(path: string): WidgetModel | undefined;
|
|
12
|
+
getPath(modelId: string): string | undefined;
|
|
13
13
|
dispatchMessage(message: IFailsInterceptorUpdateMessage): void;
|
|
14
14
|
private _modelIdToPath;
|
|
15
15
|
private _pathToModelId;
|
package/lib/index.js
CHANGED
|
@@ -116,6 +116,10 @@ function activateWidgetInterceptor(app, notebookTracker, rendermimeRegistry, lau
|
|
|
116
116
|
launcher.remoteUpdateMessageArrived.connect(async (slot, args) => {
|
|
117
117
|
// const modelId = wRegistry.getModelId(args.path);
|
|
118
118
|
const model = wRegistry.getModel(args.path);
|
|
119
|
+
if (!model) {
|
|
120
|
+
// just skip
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
119
123
|
const state = await model.constructor._deserialize_state(args.state, model.widget_manager);
|
|
120
124
|
// console.log('got an remote interceptor message', args, state);
|
|
121
125
|
for (const [key, value] of Object.entries(state)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fails-components/jupyter-interceptor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "A collections of plugins intercepting kernel messages and other message, to steer outputs remotely",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"watch:labextension": "jupyter labextension watch ."
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@fails-components/jupyter-launcher": "^0.0.
|
|
63
|
+
"@fails-components/jupyter-launcher": "^0.0.4",
|
|
64
64
|
"@jupyter-widgets/base": "^6.0.11",
|
|
65
65
|
"@jupyter-widgets/jupyterlab-manager": "^5.0.15",
|
|
66
66
|
"@jupyter/ydoc": "^3.0.4",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"sharedPackages": {
|
|
117
117
|
"@fails-components/jupyter-launcher": {
|
|
118
118
|
"singleton": true,
|
|
119
|
-
"requiredVersion": "^0.0.
|
|
119
|
+
"requiredVersion": "^0.0.4",
|
|
120
120
|
"import": false
|
|
121
121
|
}
|
|
122
122
|
}
|
package/src/index.ts
CHANGED
|
@@ -83,15 +83,15 @@ export class AppletWidgetRegistry implements IAppletWidgetRegistry {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
getModelId(path: string) {
|
|
86
|
+
getModelId(path: string): string | undefined {
|
|
87
87
|
return this._pathToModelId[path];
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
getModel(path: string) {
|
|
90
|
+
getModel(path: string): WidgetModel | undefined {
|
|
91
91
|
return this._pathToModel[path];
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
getPath(modelId: string) {
|
|
94
|
+
getPath(modelId: string): string | undefined {
|
|
95
95
|
return this._modelIdToPath[modelId];
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -169,6 +169,10 @@ function activateWidgetInterceptor(
|
|
|
169
169
|
) => {
|
|
170
170
|
// const modelId = wRegistry.getModelId(args.path);
|
|
171
171
|
const model = wRegistry.getModel(args.path);
|
|
172
|
+
if (!model) {
|
|
173
|
+
// just skip
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
172
176
|
const state = await (
|
|
173
177
|
model.constructor as typeof WidgetModel
|
|
174
178
|
)._deserialize_state(args.state, model.widget_manager);
|