File tree Expand file tree Collapse file tree 1 file changed +33
-3
lines changed
Expand file tree Collapse file tree 1 file changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export class ExecutionError {
2020 * The raw traceback of the error.
2121 **/
2222 public tracebackRaw : string [ ]
23- ) { }
23+ ) { }
2424
2525 /**
2626 * Returns the traceback of the error as a string.
@@ -175,6 +175,25 @@ export class Result {
175175
176176 return formats
177177 }
178+
179+ /**
180+ * Returns the serializable representation of the result.
181+ */
182+ toJSON ( ) {
183+ return {
184+ text : this . text ,
185+ html : this . html ,
186+ markdown : this . markdown ,
187+ svg : this . svg ,
188+ png : this . png ,
189+ jpeg : this . jpeg ,
190+ pdf : this . pdf ,
191+ latex : this . latex ,
192+ json : this . json ,
193+ javascript : this . javascript ,
194+ extra : this . extra
195+ }
196+ }
178197}
179198
180199/**
@@ -208,7 +227,7 @@ export class Execution {
208227 * An Error object if an error occurred, null otherwise.
209228 */
210229 public error ?: ExecutionError
211- ) { }
230+ ) { }
212231
213232 /**
214233 * Returns the text representation of the main result of the cell.
@@ -220,6 +239,17 @@ export class Execution {
220239 }
221240 }
222241 }
242+
243+ /**
244+ * Returns the serializable representation of the execution result.
245+ */
246+ toJSON ( ) {
247+ return {
248+ results : this . results ,
249+ logs : this . logs ,
250+ error : this . error
251+ }
252+ }
223253}
224254
225255/**
@@ -275,7 +305,7 @@ export class JupyterKernelWebSocket {
275305 * Does not start WebSocket connection!
276306 * You need to call connect() method first.
277307 */
278- constructor ( private readonly url : string ) { }
308+ constructor ( private readonly url : string ) { }
279309
280310 // public
281311 /**
You can’t perform that action at this time.
0 commit comments