You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,14 @@ When building Dash applications, you often need to write clientside callback fun
10
10
11
11
`better-dash-callback` provides a solution to this problem by allowing you to write clientside callback functions using Python syntax. This makes your code more readable, maintainable, and efficient.
12
12
13
+
## Dependencies
14
+
15
+
`better-dash-callback` depends on `metapensiero.pj`, a Python-to-JavaScript compiler that allows you to write Python code that can be executed in a JavaScript environment.
16
+
17
+
## Supported Python-to-JavaScript Syntax
18
+
19
+
The supported Python-to-JavaScript syntax is listed in the [metapensiero.pj documentation](https://github.com/metapensiero/metapensiero.pj). This includes support for many Python features, such as functions, classes, loops, and conditional statements.
20
+
13
21
## Example
14
22
15
23
Let's consider a simple example where we want to update the text of a component based on the value of an input component.
@@ -35,7 +43,8 @@ app.clientside_callback(
35
43
}
36
44
""",
37
45
Output("output", "children"),
38
-
Input("input", "value")
46
+
Input("input", "value"),
47
+
39
48
)
40
49
41
50
if__name__=="__main__":
@@ -74,9 +83,9 @@ As you can see, the `better-dash-callback` example is more elegant and easier to
74
83
The `callback` function takes the following additional arguments:
75
84
76
85
*`clientside`: A boolean indicating whether the callback should be executed on the client-side (default is `False`).
77
-
*`enable_es6`: A boolean indicating whether to enable ES6 syntax in the generated JavaScript code (default is `True`).
78
-
*`enable_stage3`: A boolean indicating whether to enable Stage 3 syntax in the generated JavaScript code (default is `True`).
79
-
*`*args` and `**kwargs`: Any arguments and keyword-arguments supported by `dash.callback` are also supported by `better-dash-callback.callback`
86
+
*`disable_es6`: A boolean indicating whether to disable ES6 syntax in the generated JavaScript code and revert back to ES5 support (default is `False`).
87
+
*`enable_stage3`: A boolean indicating whether to enable Stage 3 syntax in the generated JavaScript code (default is `False`).
88
+
* Any arguments and keyword-arguments supported by `dash.callback` are also supported by `better-dash-callback.callback`
0 commit comments