duck.html.components.core.browser_state

Refresh claims for the client using the following APIs.

Flow:

  1. User calls queue_browser_state, this adds the Page/component request ID to a registry.

  2. User calls sync_browser_state and it makes a fetch to the appropriate URL and set sensitive data directly from headers which maybe safer e.g. HttpOnly, Secure cookie

Module Contents

Functions

needs_browser_state_update

Returns a boolean on whether the request passed to the component is dirty or needs Lively to do a fetch() on the sync_browser_state view.

queue_browser_state_response

This adds component request and response that needs to be sent when user visits sync browser state view to the registry.

sync_browser_state

This syncs the browser state like updating sensitive HTTPONLY cookies.

Data

BROWSER_STATE_REGISTRY

API

duck.html.components.core.browser_state.BROWSER_STATE_REGISTRY

‘InMemoryCache(…)’

duck.html.components.core.browser_state.needs_browser_state_update(component_request: duck.http.request.HttpRequest) bool[source]

Returns a boolean on whether the request passed to the component is dirty or needs Lively to do a fetch() on the sync_browser_state view.

Parameters:

component_request – The request passed to the component.

duck.html.components.core.browser_state.queue_browser_state_response(component_request: duck.http.request.HttpRequest, response: duck.http.response.HttpResponse)[source]

This adds component request and response that needs to be sent when user visits sync browser state view to the registry.

Args: component_request: The request passed to the component.

duck.html.components.core.browser_state.sync_browser_state(request)[source]

This syncs the browser state like updating sensitive HTTPONLY cookies.

… admonition:: Notes

This will be called within Lively on client side using fetch().

Returns:

Http response added to queue else 404 HttpResponse.

Return type:

HttpResponse