[]previous and next page

@shadow-js/dusk/client

The 55 exports of @shadow-js/dusk/client: 17 functions, 2 classes, 25 interfaces, 9 types and 2 components.

Everything @shadow-js/dusk/client exports, from the TSDoc of its entry point.

Functions#

  • createSseClient: Opens an SSE stream and keeps it open: on a drop it waits (backoff, or the server's retry) and reconnects with the last event id.
  • createWebSocketClient: Opens a WebSocket and keeps it open: a drop is retried with backoff.
  • fail: Makes a failure result.
  • hydrateDusk: Starts the app in the browser on top of the server's markup.
  • hydrateIslands: Starts the islands of the page.
  • isFailure: True for a value fail made (or one that has its shape, after the wire).
  • loadScript: Loads a script in the browser (the lazyOnload strategy: call it after the window's load event).
  • serverFnStub: Creates the browser function that stands for a server function.
  • useFetcher: A fetcher: a mutation or a load that does not navigate and has its own state.
  • useFlash: The one-time value the server set with setFlash for this page (read once; the server clears the cookie).
  • useFormStatus: The status of the <Form> a component is inside: pending state and target.
  • useRevalidator: The page's revalidator: state (idle or loading) and revalidate(), which refreshes the loader data of the current location.
  • useSSE: Subscribes to a server-sent events route from a component: data holds the last event's data and status the connection's state.
  • useSubmission: The state of the latest submission of a server function (or of any submission when called without one).
  • useSubmissions: Every submission of a server function (or of all keys), oldest first, read as a function that returns the list.
  • useSubmit: A function that starts a submission of a server function on the page's store (its state then shows in useSubmission).
  • useWebSocket: Connects a WebSocket route from a component: data holds the last message, status the connection's state, and send writes to it.

Classes#

  • ServerFnError: The server failed to run the function and told the client no more than the status: an unexpected error on the server (anything that is not an HttpError), a method the function does not accept, or an aborted request.
  • ServerFnProtocolError: The answer was not a server function answer: an HTML error page from a proxy, a truncated body, a redirect the browser did not follow, an envelope of another version.

Interfaces#

  • ActionFailure: A failure returned by a server function with fail: the call succeeded and answers with a status and data (typically field problems) for the page to show.
  • AwaitProps: <Await>: shows deferred data.
  • ClientServerFn: A server function as the browser sees it: a function that returns a promise, plus the pieces a form or a tool may need.
  • DuskClient: What hydrateDusk resolves to.
  • Fetcher: A non-navigating loader or mutation with its own state.
  • FormProps: Props of Form.
  • FormStatus: What a form's descendants read with useFormStatus.
  • FormTarget: A server function as a form target: its id and endpoint.
  • HydrateDuskOptions: Options of hydrateDusk.
  • HydrateIslandsOptions: Options of hydrateIslands.
  • IslandsHandle: What hydrateIslands returns.
  • LoadScriptOptions: Options of loadScript.
  • ReconnectOptions: Reconnection policy: the delay doubles from minDelayMs up to maxDelayMs; the server's retry field (SSE) replaces the first delay.
  • Revalidator: The state of the manual revalidation of the page's loader data.
  • ServerFnCallOptions: Options of one server function call.
  • SseClient: A running SSE client.
  • SseClientOptions: Options of createSseClient.
  • SseEvent: One event of an SSE stream, as the client hands it over.
  • StreamHandle: The reactive view of a stream: what it last received, its status, and how to close it.
  • Submission: One submission, with its state as accessors.
  • SubmissionView: The read view of a submission that the hooks return: plain values, read reactively when a component reads them.
  • SubmitOptions: Options of one submission.
  • WebSocketClient: A running WebSocket client.
  • WebSocketClientOptions: Options of createWebSocketClient.
  • WebSocketHandle: The reactive view of a WebSocket: the last message, the status, and send.

Types#

components#

  • Await: Renders deferred data with a fallback and an error element.
  • Form: A form.