gowasm

command module
v0.0.0-...-bfb1546 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2018 License: MIT Imports: 5 Imported by: 0

README

Go WASM

Toolkit for building web apps with Go and WebAssembly.

Modular packages, supports building virtual dom nodes with a hyperscript style api, rendering to HTML string on the server, and DOM elements in the browser.

Features:

  • virtual dom (with patching and possible hydration)
  • hyperscript
  • server-side rendering
  • routing

Getting Started

Install dependencies:

$ go get github.com/speier/gowasm

Write a component:

package main

import (
	"github.com/speier/gowasm/pkg/dom"
	"github.com/speier/gowasm/pkg/vdom"
)

func main() {
	view := vdom.H("div", nil,
		vdom.H("h1", nil, vdom.Text("Hello World!")),
	)

	dom.Render(view, dom.QuerySelector("body"))
}

Run with dev server:

$ gowasm serve

Examples

To run the basic example with dev server:

$ gowasm serve examples/basic

To run the isomorphic example:

# generate wasm
$ go generate ./examples/isomorphic/...
# run the server
$ go run examples/isomorphic/server.go

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
examples
basic command
channels command
isomorphic command
patch command
routing command
pkg
dom
jsx

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL