diff --git a/share/jupyter/kernels/xr/resources/routines.R b/share/jupyter/kernels/xr/resources/routines.R index 8374cec..f036a1d 100644 --- a/share/jupyter/kernels/xr/resources/routines.R +++ b/share/jupyter/kernels/xr/resources/routines.R @@ -15,6 +15,10 @@ display_data <- function(data = NULL, metadata = NULL) { invisible(.Call("xeusr_display_data", jsonlite::toJSON(data), jsonlite::toJSON(metadata), PACKAGE = "(embedding)")) } +update_display_data <- function(data = NULL, metadata = NULL) { + invisible(.Call("xeusr_update_display_data", jsonlite::toJSON(data), jsonlite::toJSON(metadata), PACKAGE = "(embedding)")) +} + kernel_info_request <- function() { .Call("xeusr_kernel_info_request", PACKAGE = "(embedding)") } diff --git a/src/routines.cpp b/src/routines.cpp index 9c9d483..631fe7e 100644 --- a/src/routines.cpp +++ b/src/routines.cpp @@ -64,6 +64,18 @@ SEXP display_data(SEXP js_data, SEXP js_metadata){ return R_NilValue; } +SEXP update_display_data(SEXP js_data, SEXP js_metadata){ + auto data = nl::json::parse(CHAR(STRING_ELT(js_data, 0))); + auto metadata = nl::json::parse(CHAR(STRING_ELT(js_metadata, 0))); + + xeus_r::get_interpreter()->update_display_data( + std::move(data), std::move(metadata), /* transient = */ nl::json::object() + ); + + return R_NilValue; +} + + } void register_r_routines() { @@ -75,6 +87,7 @@ void register_r_routines() { {"xeusr_publish_execution_error" , (DL_FUNC) &routines::publish_execution_error , 3}, {"xeusr_publish_execution_result", (DL_FUNC) &routines::publish_execution_result, 3}, {"xeusr_display_data" , (DL_FUNC) &routines::display_data , 2}, + {"xeusr_update_display_data" , (DL_FUNC) &routines::update_display_data , 2}, {NULL, NULL, 0} };