Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Sources/Plot/API/Node.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ public extension Node {
static func components(@ComponentBuilder _ content: () -> Component) -> Node {
.component(content())
}

/// Create a node that lazily evaluates its contents at rendering time.
/// - parameter closure: A closure which evaluates to the contents of this node
static func `lazy`(_ closure: @escaping () -> Node ) -> Node {
Node { renderer in
closure().rendering(&renderer)
}
}
}

internal extension Node where Context: DocumentFormat {
Expand Down