Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 586830836
  • Loading branch information
colaboratory-team committed Dec 1, 2023
1 parent bc057a3 commit d33801d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions google/colab/output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 eval_js, register_callback, unregister_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
17 changes: 17 additions & 0 deletions google/colab/output/_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ def register_callback(function_name, callback):
_functions[function_name] = callback


def unregister_callback(function_name):
"""Removes a function previously registered by register_callback.
Args:
function_name: string
Raises:
ValueError: if a callback is not currently registered to function_name.
"""
try:
del _functions[function_name]
except KeyError as e:
raise ValueError(
f'Callback function not registered: {function_name}.'
) from e


def _invoke_function(function_name, json_args, json_kwargs):
"""Invokes callback with given function_name.
Expand Down

0 comments on commit d33801d

Please sign in to comment.