MCPcopy Index your code
hub / github.com/plotly/dash / register_clientside_callback

Function register_clientside_callback

dash/_callback.py:899–947  ·  view source on GitHub ↗
(
    callback_list,
    callback_map,
    config_prevent_initial_callbacks,
    inline_scripts,
    clientside_function: ClientsideFuncType,
    *args,
    **kwargs,
)

Source from the content-addressed store, hash-verified

897
898
899def register_clientside_callback(
900 callback_list,
901 callback_map,
902 config_prevent_initial_callbacks,
903 inline_scripts,
904 clientside_function: ClientsideFuncType,
905 *args,
906 **kwargs,
907):
908 output, inputs, state, prevent_initial_call = handle_callback_args(args, kwargs)
909 no_output = isinstance(output, (list,)) and len(output) == 0
910 insert_callback(
911 callback_list,
912 callback_map,
913 config_prevent_initial_callbacks,
914 output,
915 None,
916 inputs,
917 state,
918 None,
919 prevent_initial_call,
920 no_output=no_output,
921 hidden=kwargs.get("hidden", None),
922 )
923
924 # If JS source is explicitly given, create a namespace and function
925 # name, then inject the code.
926 if isinstance(clientside_function, str):
927 namespace = "_dashprivate_clientside_funcs"
928 # Create a hash from the function, it will be the same always
929 function_name = hashlib.sha256(clientside_function.encode("utf-8")).hexdigest()
930
931 inline_scripts.append(
932 _inline_clientside_template.format(
933 namespace=namespace,
934 function_name=function_name,
935 clientside_function=clientside_function,
936 )
937 )
938
939 # Callback is stored in an external asset.
940 else:
941 namespace = clientside_function.namespace
942 function_name = clientside_function.function_name
943
944 callback_list[-1]["clientside_function"] = {
945 "namespace": namespace,
946 "function_name": function_name,
947 }

Callers 1

clientside_callbackFunction · 0.85

Calls 5

handle_callback_argsFunction · 0.85
insert_callbackFunction · 0.85
getMethod · 0.45
appendMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…