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

Initializing interactive elements on the web page

The initializePage function will get called only once when the web page is first loaded. Its role is to initialize the functionality that enables user interactivity with the client-side web application. This would be the respective initialize function for a given web page, which would be responsible for initializing event handlers and reusable components (cogs).

Inside the initializePage function, we will extract the routeName from the PathName property of the window's location object; the route name for the http://localhost:8080/about URL will be "about":

l := strings.Split(env.Window.Location().Pathname, "/")routeName := l[1]if routeName == "" {  routeName = "index"}

If no routeName is available, ...

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