Skip to main content

connected

Function connected 

Source
pub fn connected(cx: &Cx) -> bool
Expand description

Returns whether this render runs over a browser connection and marks the content as needing one.

During an HTTP render, this returns false. Once the response finishes, the browser opens a connection and renders the enclosing page or shard again. That render returns true.

The connection request belongs to the enclosing page or shard. Layouts and components belong to the page that renders them. A shard inside content that already has a connection renders through it instead of opening its own.

Calling this requests a connection even if you only use the result to choose some text. Use connected_untracked to check without requesting one. Both functions describe this render, regardless of connections elsewhere in the document.

ยงPanics

Panics when called outside a rendering scope. Spawned tasks need their own rendering scope.