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

Implementing the local storage inspector

The implementation of the local storage inspector can be found in the localstorage.go source file in the client/localstoragedemo directory. In the import groupings we include the js and dom packages (shown in bold):

package localstoragedemoimport (  "github.com/gopherjs/gopherjs/js"  "honnef.co/go/js/dom")

We've defined the localStorage variable and we've assigned it the value of the localStorage object that is attached to the window object:

var localStorage = js.Global.Get("localStorage")

As usual, we've aliased the Document object with the D variable to save us some typing:

var D = dom.GetWindow().Document().(dom.HTMLDocument)

The InitializePage function is responsible for setting up the event listeners ...

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