mirror of
https://github.com/taigrr/wasm-experiments
synced 2025-01-18 04:03:21 -08:00
Update vugu to 0.2.3
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="target">
|
||||
<div id="vugu_mount_point">
|
||||
<img style="position: absolute; top: 50%; left: 50%;"
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/galleriffic/2.0.1/css/loader.gif">
|
||||
</div>
|
||||
@@ -24,7 +24,7 @@
|
||||
go.run(result.instance);
|
||||
});
|
||||
} else {
|
||||
document.getElementById("target").innerHTML = 'This application requires WebAssembly support. Please upgrade your browser.';
|
||||
document.getElementById("vugu_mount_point").innerHTML = 'This application requires WebAssembly support. Please upgrade your browser.';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
27
vugu/main.go
27
vugu/main.go
@@ -1,27 +0,0 @@
|
||||
// +build js,wasm
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/vugu/vugu"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rootInst, err := vugu.New(&Root{}, nil)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
env := vugu.NewJSEnv("#target", rootInst, vugu.RegisteredComponentTypes())
|
||||
env.DebugWriter = os.Stdout
|
||||
|
||||
for ok := true; ok; ok = env.EventWait() {
|
||||
err = env.Render()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
45
vugu/main_wasm.go
Normal file
45
vugu/main_wasm.go
Normal file
@@ -0,0 +1,45 @@
|
||||
// +build wasm
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"flag"
|
||||
|
||||
"github.com/vugu/vugu"
|
||||
"github.com/vugu/vugu/domrender"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
mountPoint := flag.String("mount-point", "#vugu_mount_point", "The query selector for the mount point for the root component, if it is not a full HTML component")
|
||||
flag.Parse()
|
||||
|
||||
fmt.Printf("Entering main(), -mount-point=%q\n", *mountPoint)
|
||||
defer fmt.Printf("Exiting main()\n")
|
||||
|
||||
buildEnv, err := vugu.NewBuildEnv()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
renderer, err := domrender.New(*mountPoint)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer renderer.Release()
|
||||
|
||||
rootBuilder := &Root{}
|
||||
|
||||
for ok := true; ok; ok = renderer.EventWait() {
|
||||
|
||||
buildResults := buildEnv.RunBuild(rootBuilder)
|
||||
|
||||
err = renderer.Render(buildResults)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
172
vugu/root.go
172
vugu/root.go
@@ -1,172 +0,0 @@
|
||||
package main
|
||||
|
||||
// DO NOT EDIT: This file was generated by vugu. Please regenerate instead of editing or add additional code in a separate file.
|
||||
|
||||
import "fmt"
|
||||
import "reflect"
|
||||
import "github.com/vugu/vugu"
|
||||
|
||||
import "encoding/json"
|
||||
import "net/http"
|
||||
import "log"
|
||||
|
||||
type RootData struct {
|
||||
bpi bpi
|
||||
isLoading bool
|
||||
}
|
||||
|
||||
type bpi struct {
|
||||
Time struct {
|
||||
Updated string `json:"updated"`
|
||||
} `json:"time"`
|
||||
BPI map[string]struct {
|
||||
Code string `json:"code"`
|
||||
Symbol string `json:"symbol"`
|
||||
RateFloat float64 `json:"rate_float"`
|
||||
} `json:"bpi"`
|
||||
}
|
||||
|
||||
func (data *RootData) HandleClick(event *vugu.DOMEvent) {
|
||||
data.bpi = bpi{}
|
||||
|
||||
go func(ee vugu.EventEnv) {
|
||||
ee.Lock()
|
||||
data.isLoading = true
|
||||
ee.UnlockRender()
|
||||
|
||||
res, err := http.Get("https://api.coindesk.com/v1/bpi/currentprice.json")
|
||||
if err != nil {
|
||||
log.Printf("Error fetch()ing: %v", err)
|
||||
return
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
var newb bpi
|
||||
err = json.NewDecoder(res.Body).Decode(&newb)
|
||||
if err != nil {
|
||||
log.Printf("Error JSON decoding: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
ee.Lock()
|
||||
defer ee.UnlockRender()
|
||||
data.bpi = newb
|
||||
data.isLoading = false
|
||||
}(event.EventEnv())
|
||||
}
|
||||
|
||||
var _ vugu.ComponentType = (*Root)(nil)
|
||||
|
||||
func (comp *Root) BuildVDOM(dataI interface{}) (vdom *vugu.VGNode, css *vugu.VGNode, reterr error) {
|
||||
data := dataI.(*RootData)
|
||||
_ = data
|
||||
_ = fmt.Sprint
|
||||
_ = reflect.Value{}
|
||||
event := vugu.DOMEventStub
|
||||
_ = event
|
||||
var n *vugu.VGNode
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "div", DataAtom: vugu.VGAtom(92931), Namespace: "", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "demo-comp"}}}
|
||||
vdom = n
|
||||
{
|
||||
parent := n
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
if data.isLoading {
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "div", DataAtom: vugu.VGAtom(92931), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
{
|
||||
parent := n
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Loading...", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
}
|
||||
}
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
if len(data.bpi.BPI) > 0 {
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "div", DataAtom: vugu.VGAtom(92931), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
{
|
||||
parent := n
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "div", DataAtom: vugu.VGAtom(92931), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
{
|
||||
parent := n
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Updated: ", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "span", DataAtom: vugu.VGAtom(40708), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
n.InnerHTML = fmt.Sprint(data.bpi.Time.Updated)
|
||||
}
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "ul", DataAtom: vugu.VGAtom(42754), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
{
|
||||
parent := n
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
for key, value := range data.bpi.BPI {
|
||||
_, _ = key, value
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "li", DataAtom: vugu.VGAtom(45570), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
{
|
||||
parent := n
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t\t", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "span", DataAtom: vugu.VGAtom(40708), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
n.InnerHTML = fmt.Sprint(key)
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: " ", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "span", DataAtom: vugu.VGAtom(40708), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
n.InnerHTML = fmt.Sprint(fmt.Sprint(value.Symbol, value.RateFloat))
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
}
|
||||
}
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
}
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
}
|
||||
}
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "button", DataAtom: vugu.VGAtom(102662), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
// @click = { data.HandleClick(event) }
|
||||
{
|
||||
var i_ interface{} = data
|
||||
idat_ := reflect.ValueOf(&i_).Elem().InterfaceData()
|
||||
var i2_ interface{} = data.HandleClick
|
||||
i2dat_ := reflect.ValueOf(&i2_).Elem().InterfaceData()
|
||||
n.SetDOMEventHandler("click", vugu.DOMEventHandler{
|
||||
ReceiverAndMethodHash: uint64(idat_[0]) ^ uint64(idat_[1]) ^ uint64(i2dat_[0]) ^ uint64(i2dat_[1]),
|
||||
Method: reflect.ValueOf(data).MethodByName("HandleClick"),
|
||||
Args: []interface{}{event},
|
||||
})
|
||||
}
|
||||
if false {
|
||||
// force compiler to check arguments for type safety
|
||||
data.HandleClick(event)
|
||||
}
|
||||
{
|
||||
parent := n
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Fetch Bitcoin Price Index", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
}
|
||||
n = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n", DataAtom: vugu.VGAtom(0), Namespace: "", Attr: []vugu.VGAttribute(nil)}
|
||||
parent.AppendChild(n)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type Root struct {}
|
||||
|
||||
func (ct *Root) NewData(props vugu.Props) (interface{}, error) { return &RootData{}, nil }
|
||||
|
||||
func init() { vugu.RegisterComponentType("root", &Root{}) }
|
||||
@@ -1,14 +1,14 @@
|
||||
<div class="demo-comp">
|
||||
<div vg-if='data.isLoading'>Loading...</div>
|
||||
<div vg-if='len(data.bpi.BPI) > 0'>
|
||||
<div>Updated: <span vg-html='data.bpi.Time.Updated'></span></div>
|
||||
<ul>
|
||||
<li vg-for='data.bpi.BPI'>
|
||||
<span vg-html='key'></span> <span vg-html='fmt.Sprint(value.Symbol, value.RateFloat)'></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<button @click="data.HandleClick(event)">Fetch Bitcoin Price Index</button>
|
||||
<div class="demo">
|
||||
<div vg-if='c.IsLoading'>Loading...</div>
|
||||
<div vg-if='len(c.PriceData.BPI) > 0'>
|
||||
<div>Updated: <span vg-html='c.PriceData.Time.Updated'></span></div>
|
||||
<ul>
|
||||
<li vg-for='c.PriceData.BPI' vg-key='key'>
|
||||
<span vg-html='key'></span> <span vg-html='fmt.Sprint(value.Symbol, value.RateFloat)'></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<button @click="c.HandleClick(event)">Fetch Bitcoin Price Index</button>
|
||||
</div>
|
||||
|
||||
<script type="application/x-go">
|
||||
@@ -16,48 +16,54 @@ import "encoding/json"
|
||||
import "net/http"
|
||||
import "log"
|
||||
|
||||
type RootData struct {
|
||||
bpi bpi
|
||||
isLoading bool
|
||||
type Root struct {
|
||||
PriceData bpi `vugu:"data"`
|
||||
IsLoading bool `vugu:"data"`
|
||||
}
|
||||
|
||||
type bpi struct {
|
||||
Time struct {
|
||||
Updated string `json:"updated"`
|
||||
} `json:"time"`
|
||||
BPI map[string]struct {
|
||||
Code string `json:"code"`
|
||||
Symbol string `json:"symbol"`
|
||||
RateFloat float64 `json:"rate_float"`
|
||||
} `json:"bpi"`
|
||||
Time struct {
|
||||
Updated string `json:"updated"`
|
||||
} `json:"time"`
|
||||
BPI map[string]struct {
|
||||
Code string `json:"code"`
|
||||
Symbol string `json:"symbol"`
|
||||
RateFloat float64 `json:"rate_float"`
|
||||
} `json:"bpi"`
|
||||
}
|
||||
|
||||
func (data *RootData) HandleClick(event *vugu.DOMEvent) {
|
||||
data.bpi = bpi{}
|
||||
func (c *Root) HandleClick(event *vugu.DOMEvent) {
|
||||
|
||||
go func(ee vugu.EventEnv) {
|
||||
ee.Lock()
|
||||
data.isLoading = true
|
||||
ee.UnlockRender()
|
||||
c.PriceData = bpi{}
|
||||
|
||||
res, err := http.Get("https://api.coindesk.com/v1/bpi/currentprice.json")
|
||||
if err != nil {
|
||||
log.Printf("Error fetch()ing: %v", err)
|
||||
return
|
||||
}
|
||||
defer res.Body.Close()
|
||||
ee := event.EventEnv()
|
||||
|
||||
var newb bpi
|
||||
err = json.NewDecoder(res.Body).Decode(&newb)
|
||||
if err != nil {
|
||||
log.Printf("Error JSON decoding: %v", err)
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
|
||||
ee.Lock()
|
||||
defer ee.UnlockRender()
|
||||
data.bpi = newb
|
||||
data.isLoading = false
|
||||
}(event.EventEnv())
|
||||
ee.Lock()
|
||||
c.IsLoading = true
|
||||
ee.UnlockRender()
|
||||
|
||||
res, err := http.Get("https://api.coindesk.com/v1/bpi/currentprice.json")
|
||||
if err != nil {
|
||||
log.Printf("Error fetch()ing: %v", err)
|
||||
return
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
var newb bpi
|
||||
err = json.NewDecoder(res.Body).Decode(&newb)
|
||||
if err != nil {
|
||||
log.Printf("Error JSON decoding: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
ee.Lock()
|
||||
defer ee.UnlockRender()
|
||||
c.PriceData = newb
|
||||
c.IsLoading = false
|
||||
|
||||
}()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
186
vugu/root_vgen.go
Normal file
186
vugu/root_vgen.go
Normal file
@@ -0,0 +1,186 @@
|
||||
package main
|
||||
|
||||
// DO NOT EDIT: This file was generated by vugu. Please regenerate instead of editing or add additional code in a separate file.
|
||||
|
||||
import "fmt"
|
||||
import "reflect"
|
||||
import "github.com/vugu/vjson"
|
||||
import "github.com/vugu/vugu"
|
||||
import js "github.com/vugu/vugu/js"
|
||||
|
||||
import "encoding/json"
|
||||
import "net/http"
|
||||
import "log"
|
||||
|
||||
type Root struct {
|
||||
PriceData bpi `vugu:"data"`
|
||||
IsLoading bool `vugu:"data"`
|
||||
}
|
||||
|
||||
type bpi struct {
|
||||
Time struct {
|
||||
Updated string `json:"updated"`
|
||||
} `json:"time"`
|
||||
BPI map[string]struct {
|
||||
Code string `json:"code"`
|
||||
Symbol string `json:"symbol"`
|
||||
RateFloat float64 `json:"rate_float"`
|
||||
} `json:"bpi"`
|
||||
}
|
||||
|
||||
func (c *Root) HandleClick(event *vugu.DOMEvent) {
|
||||
|
||||
c.PriceData = bpi{}
|
||||
|
||||
ee := event.EventEnv()
|
||||
|
||||
go func() {
|
||||
|
||||
ee.Lock()
|
||||
c.IsLoading = true
|
||||
ee.UnlockRender()
|
||||
|
||||
res, err := http.Get("https://api.coindesk.com/v1/bpi/currentprice.json")
|
||||
if err != nil {
|
||||
log.Printf("Error fetch()ing: %v", err)
|
||||
return
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
var newb bpi
|
||||
err = json.NewDecoder(res.Body).Decode(&newb)
|
||||
if err != nil {
|
||||
log.Printf("Error JSON decoding: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
ee.Lock()
|
||||
defer ee.UnlockRender()
|
||||
c.PriceData = newb
|
||||
c.IsLoading = false
|
||||
|
||||
}()
|
||||
}
|
||||
|
||||
func (c *Root) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
|
||||
|
||||
vgout = &vugu.BuildOut{}
|
||||
|
||||
var vgiterkey interface{}
|
||||
_ = vgiterkey
|
||||
var vgn *vugu.VGNode
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "demo"}}}
|
||||
vgout.Out = append(vgout.Out, vgn) // root for output
|
||||
{
|
||||
vgparent := vgn
|
||||
_ = vgparent
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n "}
|
||||
vgparent.AppendChild(vgn)
|
||||
if c.IsLoading {
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute(nil)}
|
||||
vgparent.AppendChild(vgn)
|
||||
{
|
||||
vgparent := vgn
|
||||
_ = vgparent
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Loading..."}
|
||||
vgparent.AppendChild(vgn)
|
||||
}
|
||||
}
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n "}
|
||||
vgparent.AppendChild(vgn)
|
||||
if len(c.PriceData.BPI) > 0 {
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute(nil)}
|
||||
vgparent.AppendChild(vgn)
|
||||
{
|
||||
vgparent := vgn
|
||||
_ = vgparent
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n "}
|
||||
vgparent.AppendChild(vgn)
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute(nil)}
|
||||
vgparent.AppendChild(vgn)
|
||||
{
|
||||
vgparent := vgn
|
||||
_ = vgparent
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Updated: "}
|
||||
vgparent.AppendChild(vgn)
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)}
|
||||
vgparent.AppendChild(vgn)
|
||||
{
|
||||
vghtml := fmt.Sprint(c.PriceData.Time.Updated)
|
||||
vgn.InnerHTML = &vghtml
|
||||
}
|
||||
}
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n "}
|
||||
vgparent.AppendChild(vgn)
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "ul", Attr: []vugu.VGAttribute(nil)}
|
||||
vgparent.AppendChild(vgn)
|
||||
{
|
||||
vgparent := vgn
|
||||
_ = vgparent
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n "}
|
||||
vgparent.AppendChild(vgn)
|
||||
for key, value := range c.PriceData.BPI {
|
||||
var vgiterkey interface{} = key
|
||||
_ = vgiterkey
|
||||
key := key
|
||||
_ = key
|
||||
value := value
|
||||
_ = value
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "li", Attr: []vugu.VGAttribute(nil)}
|
||||
vgparent.AppendChild(vgn)
|
||||
{
|
||||
vgparent := vgn
|
||||
_ = vgparent
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n "}
|
||||
vgparent.AppendChild(vgn)
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)}
|
||||
vgparent.AppendChild(vgn)
|
||||
{
|
||||
vghtml := fmt.Sprint(key)
|
||||
vgn.InnerHTML = &vghtml
|
||||
}
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: " "}
|
||||
vgparent.AppendChild(vgn)
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)}
|
||||
vgparent.AppendChild(vgn)
|
||||
{
|
||||
vghtml := fmt.Sprint(fmt.Sprint(value.Symbol, value.RateFloat))
|
||||
vgn.InnerHTML = &vghtml
|
||||
}
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n "}
|
||||
vgparent.AppendChild(vgn)
|
||||
}
|
||||
}
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n "}
|
||||
vgparent.AppendChild(vgn)
|
||||
}
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n "}
|
||||
vgparent.AppendChild(vgn)
|
||||
}
|
||||
}
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n "}
|
||||
vgparent.AppendChild(vgn)
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "button", Attr: []vugu.VGAttribute(nil)}
|
||||
vgparent.AppendChild(vgn)
|
||||
vgn.DOMEventHandlerSpecList = append(vgn.DOMEventHandlerSpecList, vugu.DOMEventHandlerSpec{
|
||||
EventType: "click",
|
||||
Func: func(event *vugu.DOMEvent) { c.HandleClick(event) },
|
||||
// TODO: implement capture, etc. mostly need to decide syntax
|
||||
})
|
||||
{
|
||||
vgparent := vgn
|
||||
_ = vgparent
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Fetch Bitcoin Price Index"}
|
||||
vgparent.AppendChild(vgn)
|
||||
}
|
||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n"}
|
||||
vgparent.AppendChild(vgn)
|
||||
}
|
||||
return vgout
|
||||
}
|
||||
|
||||
// 'fix' unused imports
|
||||
var _ fmt.Stringer
|
||||
var _ reflect.Type
|
||||
var _ vjson.RawMessage
|
||||
var _ js.Value
|
||||
Reference in New Issue
Block a user