pub fn graph_drive_script(
container_id: &str,
data: &GraphData,
call: GraphDrive,
) -> StringExpand description
Builds the JavaScript that stores data (serialized) as container container_id’s entry in
window.__beginGraphData and invokes the GraphDrive method call on window.beginGraph
when the driver script (begin/assets/graph.js) is loaded.
container_id is embedded as a JSON-encoded JS string literal, so any characters it contains
(quotes, backslashes, newlines) are escaped rather than breaking or injecting into the emitted
JS — graph_id is a public GraphView prop, so the id is not assumed to be a bare DOM id.
The invoked method name comes from the GraphDrive enum, never a free string, so it can
never be an arbitrary (injecting) value.
- Complexity: O(n) in the size of
data(serialization plus string formatting).