Skip to content

Commit 9ba318f

Browse files
committed
docs update
1 parent 9147104 commit 9ba318f

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

chartlets.py/chartlets/contribution.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ def layout(self, *args) -> Callable:
4545
"""A decorator for a user-provided function that
4646
returns the initial user interface layout.
4747
48+
The layout decorator should only be used once for
49+
given contribution instance.
50+
4851
The decorated function must return an instance of
4952
a `chartlets.Component`, usually a `chartlets.components.Box`
5053
that arranges other components in some layout.
@@ -77,7 +80,36 @@ def decorator(function: Callable) -> Callable:
7780
return decorator
7881

7982
def callback(self, *args: Channel) -> Callable[[Callable], Callable]:
80-
"""Decorator."""
83+
"""A decorator for a user-provided callback function.
84+
85+
Callback functions are event handlers that react
86+
to events fired by the host application state or by events
87+
fired by related components provided by this contribution's
88+
user interface.
89+
90+
The callback decorator can be used more than once for a
91+
given contribution instance.
92+
93+
The decorated function can return ...
94+
95+
The first parameter of the decorated function must be a
96+
positional argument. It provides an application-specific
97+
context that is used to allow for access server-side
98+
configuration and resources. The parameter should be
99+
called `ctx`.
100+
101+
Other parameters of the decorated function are user-defined
102+
and must have a corresponding `chartlets.Input` argument
103+
in the `layout` decorator in the same order.
104+
105+
Args:
106+
args: Instances of the `chartlets.Input` class that
107+
define the source of the value for the corresponding
108+
parameter of the decorated function. Optional.
109+
110+
Returns:
111+
The decorated, user-provided function.
112+
"""
81113

82114
def decorator(function: Callable) -> Callable:
83115
self.callbacks.append(

0 commit comments

Comments
 (0)