@basthon/gui-base 0.73.0 → 0.73.2

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/main.d.ts CHANGED
@@ -221,4 +221,10 @@ export declare class GUIBase {
221
221
  * like in tutor.
222
222
  */
223
223
  handleDynamicIFrame(iframe: HTMLIFrameElement): Promise<void>;
224
+ /**
225
+ * Handle communication between iframe and kernel
226
+ * (e.g. matplotlib). Iframe comes from a display event,
227
+ * like in matplotlib.
228
+ */
229
+ handleKernelIFrame(iframe: HTMLIFrameElement, port: MessagePort): Promise<void>;
224
230
  }
package/lib/main.js CHANGED
@@ -574,6 +574,19 @@ Un lien permanant vers le contenu actuel a été créé.
574
574
  }, { root: document.documentElement });
575
575
  observer.observe(iframe);
576
576
  }
577
+ /**
578
+ * Handle communication between iframe and kernel
579
+ * (e.g. matplotlib). Iframe comes from a display event,
580
+ * like in matplotlib.
581
+ */
582
+ async handleKernelIFrame(iframe, port) {
583
+ // wait for iframe to be ready
584
+ await new Promise((resolve, reject) => {
585
+ iframe.onload = () => resolve();
586
+ iframe.onerror = reject;
587
+ });
588
+ iframe.contentWindow.postMessage(port, "*", [port]);
589
+ }
577
590
  }
578
591
  /**
579
592
  * Copy a text to clipboard.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basthon/gui-base",
3
- "version": "0.73.0",
3
+ "version": "0.73.2",
4
4
  "description": "Basthon - Base GUI",
5
5
  "homepage": "https://basthon.fr",
6
6
  "bugs": {
@@ -25,9 +25,9 @@
25
25
  "clean": "rimraf lib/"
26
26
  },
27
27
  "dependencies": {
28
- "@basthon/checkpoints": "0.73.0",
29
- "@basthon/kernel-base": "0.73.0",
30
- "@basthon/kernel-loader": "0.73.0",
28
+ "@basthon/checkpoints": "0.73.2",
29
+ "@basthon/kernel-base": "0.73.2",
30
+ "@basthon/kernel-loader": "0.73.2",
31
31
  "js-base64": "^3.7.7",
32
32
  "pako": "^2.1.0",
33
33
  "promise-delegate": "^1.0.1"
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "d2242fe56dfc7de0e5d3be35a0a01bf6f58c162e"
43
+ "gitHead": "95bbd19a61673aecea85f72bc03cfe5cbcb26660"
44
44
  }