Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Commit 09ffcf3

Browse files
committed
feat: log postMessage calls to jupyter lab API contents
1 parent c3184dd commit 09ffcf3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/events.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ export interface NotebookEventData {
6363
export const send = (type: NotebookEventTypeValue, payload = '') => {
6464
const event: NotebookEventData = { type, payload };
6565
const parent = window.parent;
66+
67+
const { origin } = window.location;
68+
const jupyterConfigData = JSON.parse(
69+
document.getElementById('jupyter-config-data').textContent
70+
);
71+
fetch(
72+
`${origin}${
73+
jupyterConfigData.baseUrl
74+
}/api/contents?postMessage=${JSON.stringify(event)}`
75+
);
6676
parent.postMessage(event, '*');
6777
};
6878

0 commit comments

Comments
 (0)