Skip to content

Commit

Permalink
udpate: adjust schema usage
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Mar 13, 2024
1 parent 2dec312 commit 6f2abc2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion dist/other/jupyterlite/JupyterLiteSession.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JupyterliteMessageSchema } from "@mat3ra/esse/lib/js/types";
import React from "react";
interface JupyterLiteSessionProps {
originURL: string;
Expand All @@ -9,7 +10,7 @@ declare class JupyterLiteSession extends React.Component<JupyterLiteSessionProps
static defaultProps: Partial<JupyterLiteSessionProps>;
componentDidMount(): void;
componentWillUnmount(): void;
receiveMessage: (event: MessageEvent) => void;
receiveMessage: (event: MessageEvent<JupyterliteMessageSchema>) => void;
sendData: (data: Record<string, unknown>[], variableName: string) => void;
render(): React.JSX.Element;
}
Expand Down
5 changes: 4 additions & 1 deletion dist/other/jupyterlite/JupyterLiteSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ class JupyterLiteSession extends React.Component {
}
};
this.sendData = (data, variableName) => {
const message = { type: "from-host-to-iframe", data, variableName };
const message = {
type: "from-host-to-iframe",
payload: { data, variableName },
};
const iframe = document.getElementById(this.props.frameId);
if (iframe && iframe.contentWindow) {
iframe.contentWindow.postMessage(message, this.props.originURL);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
},
"devDependencies": {
"@exabyte-io/code.js": "^2024.2.20-0",
"@mat3ra/esse": "https://github.com/Exabyte-io/esse.git#56051891cc8d54a8f17ff16edacc75894450bb4c",
"@mat3ra/esse": "https://github.com/Exabyte-io/esse.git#bdf3516f2f7caef4567f1a4253925979273f69ed",
"@exabyte-io/eslint-config": "^2023.8.29-1",
"@mui/icons-material": "^5.11.9",
"@mui/lab": "^5.0.0-alpha.120",
Expand Down
2 changes: 1 addition & 1 deletion src/other/jupyterlite/JupyterLiteSession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class JupyterLiteSession extends React.Component<JupyterLiteSessionProps> {
if (event.origin !== new URL(this.props.originURL).origin) return;
if (event.data) {
if (event.data.type === "from-iframe-to-host") {
if (this.props.receiveData) this.props.receiveData(event.data.payload);
if (this.props.receiveData) this.props.receiveData(event.data);
}
}
};
Expand Down

0 comments on commit 6f2abc2

Please sign in to comment.