github.com/jgarto/itcv@v0.0.0-20180826224514-4eea09c1aa0d/examples/sites/latency/main.go (about) 1 // Copyright (c) 2016 Paul Jolly <paul@myitcv.org.uk>, all rights reserved. 2 // Use of this document is governed by a license found in the LICENSE document. 3 4 package main 5 6 import ( 7 "net/url" 8 9 "myitcv.io/react" 10 11 "honnef.co/go/js/dom" 12 ) 13 14 //go:generate reactGen 15 16 var document = dom.GetWindow().Document().(dom.HTMLDocument) 17 18 func main() { 19 domTarget := document.GetElementByID("app") 20 21 u, err := url.Parse(document.URL()) 22 if err != nil { 23 panic(err) 24 } 25 26 var elems []react.Element 27 28 if u.Query().Get("hideGithubRibbon") != "true" { 29 a := react.A( 30 &react.AProps{ 31 ClassName: "github-fork-ribbon right-top", 32 Target: "_blank", 33 Href: "https://github.com/myitcv/react/blob/master/examples/sites/latency/main.go", 34 Title: "Source on GitHub", 35 }, 36 react.S("Source on GitHub"), 37 ) 38 39 elems = append(elems, a) 40 } 41 42 elems = append(elems, Latency()) 43 44 react.Render(react.Div(nil, elems...), domTarget) 45 }