go-hyperscript

module
v0.0.0-...-1517dce Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2021 License: MIT

README

go-hyperscript

  • Simple hyperscript like script implemented in Go.
  • You can use this package in these ways:
    • Write HTML using Go function.
    • Update existing DOM based on previous VNode tree.

Usage

Write HTML using Go function
func main() {
	node := h.H("div", nil,
		h.H("h1", nil, h.Text("Example App")),
		h.H("strong", nil,
			h.H("font", h.Object{"color": "red"}, h.Text("Hello, world!")),
		),
		...
	)
	body := js.Global().Get("document").Get("body")
	dom.NewRenderer().Render(node, body)
}
Example
Update DOM
  • Now go-hyperscript provides basic support for reusing and updating existing DOM.
  • To use this function, please render multiple times using same renderer.
Examples

Environment

  • go 1.13

Development

make build
make test

Author

syumai

License

MIT

Jump to

Keyboard shortcuts

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