From e12bed21c7e2c961944fa444225979ad0c08ec28 Mon Sep 17 00:00:00 2001 From: Google Colaboratory Team Date: Tue, 28 Nov 2023 13:41:19 -0800 Subject: [PATCH] No public description PiperOrigin-RevId: 586090452 --- google/colab/output/__init__.py | 4 ++-- google/colab/output/_js.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/google/colab/output/__init__.py b/google/colab/output/__init__.py index 3c73fc5c..6939d9a1 100644 --- a/google/colab/output/__init__.py +++ b/google/colab/output/__init__.py @@ -14,7 +14,7 @@ """Colabs output package.""" # pylint: disable=g-multiple-import from google.colab.output._area import redirect_to_element, to_default_area, to_footer_area, to_header_area -from google.colab.output._js import eval_js, register_callback +from google.colab.output._js import deregister_callback, eval_js, register_callback from google.colab.output._tags import clear, temporary, use_tags from google.colab.output._util import serve_kernel_port_as_iframe, serve_kernel_port_as_window -from google.colab.output._widgets import enable_custom_widget_manager, disable_custom_widget_manager +from google.colab.output._widgets import disable_custom_widget_manager, enable_custom_widget_manager diff --git a/google/colab/output/_js.py b/google/colab/output/_js.py index 52909ffd..aca488ae 100644 --- a/google/colab/output/_js.py +++ b/google/colab/output/_js.py @@ -61,6 +61,15 @@ def register_callback(function_name, callback): _functions[function_name] = callback +def deregister_callback(function_name): + """Removes a function previously registered by register_callback. + + Args: + function_name: string + """ + del _functions[function_name] + + def _invoke_function(function_name, json_args, json_kwargs): """Invokes callback with given function_name.