This repository was archived by the owner on Jun 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -63,16 +63,6 @@ export interface NotebookEventData {
63
63
export const send = ( type : NotebookEventTypeValue , payload = '' ) => {
64
64
const event : NotebookEventData = { type, payload } ;
65
65
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
- ) ;
76
66
parent . postMessage ( event , '*' ) ;
77
67
} ;
78
68
@@ -206,6 +196,19 @@ export const onNotebookEventReceived = (
206
196
NotebookUnmount
207
197
} = NotebookEventType ;
208
198
199
+ const { origin } = window . location ;
200
+ const jupyterConfigData = JSON . parse (
201
+ document . getElementById ( 'jupyter-config-data' ) . textContent
202
+ ) ;
203
+
204
+ /**
205
+ * We call jupyter's contents API; while this call technically does nothing it will log the API call to console which will be
206
+ * added to Cloudwatch where we will be able to query if needed.
207
+ */
208
+ fetch (
209
+ `${ origin } ${ jupyterConfigData . baseUrl } api/contents?postMessage=${ type } &origin=${ message . origin } `
210
+ ) ;
211
+
209
212
switch ( type ) {
210
213
/**
211
214
* The idea for this event is that when the container is initializing the notebook, it can potentially send the state of a
You can’t perform that action at this time.
0 commit comments