Skip to content

Instantly share code, notes, and snippets.

@adamdriscoll
Created February 16, 2018 02:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamdriscoll/f3eacce165e98a601586677855559732 to your computer and use it in GitHub Desktop.
Save adamdriscoll/f3eacce165e98a601586677855559732 to your computer and use it in GitHub Desktop.
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