O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up the template set on the client side

Now that we've seen how a web template gets rendered on the server side, it's time to focus on how a web template gets rendered on the client side. The primary entry point of our client-side web application is the main function defined in the client.go source file in the client folder:

func main() {  var D = dom.GetWindow().Document().(dom.HTMLDocument)  switch readyState := D.ReadyState(); readyState {  case "loading":    D.AddEventListener("DOMContentLoaded", false, func(dom.Event) {      go run()    })  case "interactive", "complete":    run()  default:    println("Encountered unexpected document ready state value!")  }}

First, we assign the document object to the D variable, we're performing the usual aliasing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required