Module perseus::shell[][src]

Expand description

Utilities to do with the app shell. You probably don’t want to delve into here.

Enums

A representation of whether or not the initial state was present. If it was, it could be None (some templates take no state), and if not, then this isn’t an initial load, and we need to request the page from the server. It could also be an error that the server has rendered.

Functions

Fetches the information for the given page and renders it. This should be provided the actual path of the page to render (not just the broader template). Asynchronous Wasm is handled here, because only a few cases need it.

Marks a checkpoint in the code and alerts any tests that it’s been reached by creating an element that represents it. The preferred solution would be emitting a DOM event, but the WebDriver specification currently doesn’t support waiting on those (go figure). This will only create a custom element if the __PERSEUS_TESTING JS global variable is set to true.

Gets the initial state injected by the server, if there was any. This is used to differentiate initial loads from subsequent ones, which have different log chains to prevent double-trips (a common SPA problem).

Gets the render configuration from the JS global variable __PERSEUS_RENDER_CFG, which should be inlined by the server. This will return None on any error (not found, serialization failed, etc.), which should reasonably lead to a panic! in the caller.