Skip to content

Instantly share code, notes, and snippets.

@beber89

beber89/renderer.go

Created Sep 17, 2019
Embed
What would you like to do?
renderer.go
// renderPage reloads elements of the page when change to wallet occurs
func RenderPage() {
wlt := *GetWallet()
document := js.Global().Get("document")
chainView := (*wlt.GetBlockchain()).Draw()
if chn := document.Call("getElementById", "chain"); chn != js.Null() {
document.Call("getElementById", "blockchain-placeholder").Call("removeChild", chn)
}
document.Call("getElementById", "blockchain-placeholder").Call("appendChild", chainView)
networthLabel := document.Call("getElementById", "networth")
networthLabel.Set("innerHTML", wlt.Networth())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment