bookmark.Bookmark
self) bookmark.Bookmark(
Attributes
Name | Description |
---|---|
exclude | A list of scoped Input names to exclude from bookmarking. |
store | App’s bookmark store value |
Methods
Name | Description |
---|---|
do_bookmark | Perform bookmarking. |
get_bookmark_url | Get the URL of the current bookmark state |
on_bookmark | Registers a function that will be called just before bookmarking state. |
on_bookmarked | Registers a function that will be called just after bookmarking state. |
on_restore | Registers a function that will be called just before restoring state. |
on_restored | Registers a function that will be called just after restoring state. |
show_bookmark_url_modal | Display a modal dialog for displaying the bookmark URL. |
update_query_string | Update the query string of the current URL. |
do_bookmark
bookmark.Bookmark.do_bookmark()
Perform bookmarking.
This method will also call the on_bookmark
and on_bookmarked
callbacks to alter the bookmark state. Then, the bookmark state will be either saved to the server or encoded in the URL, depending on the .store
option.
No actions will be performed if the .store
option is set to "disable"
.
Note: this method is called when session.bookmark()
is executed.
get_bookmark_url
bookmark.Bookmark.get_bookmark_url()
Get the URL of the current bookmark state
This method should return the full URL, including the query string.
As a side effect, all on_bookmark
callbacks will be invoked to allow the bookmark state to be modified before it is serialized. This will cause the bookmark state to be serialized to disk when session.bookmark.store == "server"
.
Returns
: str | None
-
The full URL of the current bookmark state, including the query string.
None
if bookmarking is not enabled.
on_bookmark
/) bookmark.Bookmark.on_bookmark(callback,
Registers a function that will be called just before bookmarking state.
This callback will be executed before the bookmark state is saved serverside or in the URL.
Parameters
callback : Callable[[BookmarkState], None] | Callable[[BookmarkState], Awaitable[None]]
-
The callback function to call when the session is bookmarked. This method should accept a single argument, which is a
ShinySaveState
object.
on_bookmarked
/) bookmark.Bookmark.on_bookmarked(callback,
Registers a function that will be called just after bookmarking state.
This callback will be executed after the bookmark state is saved serverside or in the URL.
Parameters
on_restore
bookmark.Bookmark.on_restore(callback)
Registers a function that will be called just before restoring state.
This callback will be executed before the bookmark state is restored.
on_restored
bookmark.Bookmark.on_restored(callback)
Registers a function that will be called just after restoring state.
This callback will be executed after the bookmark state is restored.
show_bookmark_url_modal
=None) bookmark.Bookmark.show_bookmark_url_modal(url
Display a modal dialog for displaying the bookmark URL.
This method should be called when the bookmark button is clicked, and it should display a modal dialog with the current bookmark URL.
Parameters
url : str | None = None
-
The URL to display in the modal dialog. If
None
, the current bookmark URL will be retrieved usingsession.bookmark.get_bookmark_url()
.
update_query_string
=None, mode='replace') bookmark.Bookmark.update_query_string(query_string
Update the query string of the current URL.