Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/handler/README_DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ This can work out of the box with the default docker bundle.
All you have to do is updating the `setup/initialize.sh` script to run the app once so that asset collection can occur.
Example:
```bash
uv run your-trame-app-entrypoint --timeout 1
python -m your-trame-app-entrypoint --timeout 1 --server
```
16 changes: 10 additions & 6 deletions trame_client/widgets/trame.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ def register_external_script(
Args:
script_file_path (Path | str):
The local of the script you want to register. Can be either a local or a remote script. Accepts:

- `Path`: local path to your script on the filesystem
- `str`: an valid URL to the script
function_names (list[str]): public API of your script that you want to expose to the Handler widget.
Expand Down Expand Up @@ -414,13 +415,15 @@ class Handler(AbstractElement):
It manages the execution flow between the Python state and JavaScript functions,
providing events to monitor execution status.

For usage with the docker setup, please see `README_DOCKER.md <https://github.com/Kitware/trame-client/blob/master/examples/handler/README_DOCKER.md>`_.

Args:
function (UserDefinedFunction | tuple[str, str] | ExternalScript | str):
The JavaScript function to execute. Accepts:

- `UserDefinedFunction`: Obtained from `ExternalScript.function`.
- `tuple[str, str]`: A `(module_name, function_name)` pair.
- `ExternalScript`: An object from `register_external_script` (must
contain exactly one function).
- `ExternalScript`: An object from `register_external_script` (must contain exactly one function).
- `str`: The registration identifier of an external script.
variable (str): The name of the state variable to be passed as the
primary input to the function.
Expand All @@ -430,10 +433,11 @@ class Handler(AbstractElement):
to be passed as arguments to the function. Defaults to None.

Events:
completed: A generic event emitted regardless of the execution outcome.
success: Emitted when the function executes and returns successfully.
failure: Emitted when the function reports a handled error.
error: Emitted when an unhandled exception occurs during execution.

- completed: A generic event emitted regardless of the execution outcome.
- success: Emitted when the function executes and returns successfully.
- failure: Emitted when the function reports a handled error.
- error: Emitted when an unhandled exception occurs during execution.
"""

def __init__(
Expand Down
Loading