Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes in text of hold.md #7487

Merged
merged 1 commit into from
Nov 14, 2024
Merged
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
8 changes: 6 additions & 2 deletions doc/how_to/performance/hold.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ The `hold` function is a context manager and decorator that temporarily holds ev

## Using `hold`

If you have a function that updates components and you want to ensure that all updates are held, you can use hold as a decorator, e.g. here we update 100 components at once. If you do not hold then each of these events is sent and applied in series, potentially resulting in visible updates.
### As a decorator

If you have a function that updates components and you want to ensure that all updates are held, you can use hold as a decorator. E.g. here we update 100 components at once. If you do not hold then each of these events is sent and applied in series, potentially resulting in visible updates.

```{pyodide}
import panel as pn
Expand All @@ -29,7 +31,9 @@ pn.Column(column, button).servable()

Applying the hold decorator means all the updates are sent in a single Websocket message and applied on the frontend simultaneously.

Alternatively the `hold` function can be used as a context manager, potentially giving you finer grained control over which events are batched and which are not:
### As a context manager

Alternatively, the `hold` function can be used as a context manager, potentially giving you finer grained control over which events are batched and which are not:

```{pyodide}
import time
Expand Down
Loading