duck.html.components.livelyยถ

Module containing Scripts component that injects all required scripts to enable the Lively Component System on the client side via WebSocket.

Includes:

  • msgpack.min.js: For MessagePack encoding/decoding.

  • lively.js: Main Lively client-side runtime.

  • Inline JS: Instantiates and connects a LivelyWebSocketClient.

Notes:

  • msgpack.min.js is required and always included.

  • Scripts are injected in the order: msgpack, lively, then inline connect.

Module Contentsยถ

Classesยถ

LivelyScripts

Component that injects all required scripts to enable the Lively Component System on the client side via WebSocket.

APIยถ

class duck.html.components.lively.LivelyScripts(element: Optional[str] = None, properties: Optional[Dict[str, str]] = None, props: Optional[Dict[str, str]] = None, style: Optional[Dict[str, str]] = None, inner_html: Optional[Union[str, str, float]] = None, children: Optional[List[duck.html.components.HtmlComponent]] = None, **kwargs)[source]ยถ

Bases: duck.html.components.container.Container

Component that injects all required scripts to enable the Lively Component System on the client side via WebSocket.

Includes:

  • msgpack.min.js: For MessagePack encoding/decoding.

  • lively.js: Main Lively client-side runtime.

  • Inline JS: Instantiates and connects a LivelyWebSocketClient.

โ€ฆ admonition:: Notes

  • msgpack.min.js is required and always included.

  • Scripts are injected in the order: msgpack, lively, then inline connect.

Initialization

Initialize an HTML component.

Parameters:
  • element โ€“ The HTML element tag name (e.g., textarea, input, button). Can be None, but make sure element is returned by get_element method.

  • accept_inner_html โ€“ Whether the HTML component accepts an inner body (e.g., inner-body-here).

  • inner_html โ€“ Inner html to add to the HTML component. Defaults to None.

  • properties โ€“ Dictionary for properties to initialize the component with.

  • props โ€“ Just same as properties argument (added for simplicity).

  • style โ€“ Dictionary for style to initialize the component with.

  • **kwargs โ€“ Extra keyword arguments

Raises:

HtmlComponentError โ€“ If โ€˜elementโ€™ is not a string or โ€˜inner_htmlโ€™ is set but โ€˜accept_inner_htmlโ€™ is False.

on_create()[source]ยถ