Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Sep 26, 2022
1 parent 3927d88 commit 9899ac0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/user_guide/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ The `pn.config` object allows setting various configuration variables, the confi
> - `js_files`: External JS files to load. Dictionary should map from exported name to the URL of the JS file.
> - `loading_spinner`: The style of the global loading indicator, e.g. 'arcs', 'bars', 'dots', 'petals'.
> - `loading_color`: The color of the global loading indicator as a hex color, e.g. #6a6a6a
> - `defer_load`: Whether reactive function evaluation is deferred until the page is rendered.
> - `nthreads`: If set will start a `ThreadPoolExecutor` to dispatch events to for concurrent execution on separate cores. By default no thread pool is launched, while setting nthreads=0 launches `min(32, os.cpu_count() + 4)` threads.
> - `raw_css`: List of raw CSS strings to add to load.
> - `reuse_sessions`: Whether to reuse a session for the initial request to speed up the initial page render. Note that if the initial page differs between sessions, e.g. because it uses query parameters to modify the rendered content, then this option will result in the wrong content being rendered. See the [Performance and Debugging guide](Performance_and_Debugging.rst#Reuse-sessions) for more information.
Expand Down
19 changes: 19 additions & 0 deletions examples/user_guide/Session_State_and_Callbacks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,25 @@
"# pn.serve(app) "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Alternatively we may also use the `defer_load` option to wait to evaluate a function until the page is loaded. This will render a placeholder and display the global `config.loading_spinner`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def render_on_load():\n",
" return pn.widgets.Select(options=['A', 'B', 'C'])\n",
"\n",
"pn.Row(pn.panel(render_on_load, defer_load=True))"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 9899ac0

Please sign in to comment.