Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Real time updates using Set-UDElement and Get-UDElement
$dashboard = New-UDDashboard -Title "PowerShell Universal Dashboard" -Content {
New-UDRow -Columns {
New-UDColumn -Size 1 {
New-UDElement -Tag "input" -Attributes @{
type = "button"
value = "Click me!"
onClick = {
$Element = Get-UDElement -Id "textbox"
if ($Element.Content[0] -eq "Wax on") {
Set-UDElement -Id "textbox" -Content {
"Wax off"
}
} else {
Set-UDElement -Id "textbox" -Content {
"Wax on"
}
}
}
}
}
New-UDColumn -Size 1 {
New-UDElement -Id "textbox" -Tag "span" -Content {
"Wax off"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment