vdom

package
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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attrs

type Attrs struct {
	Props  *Props
	Events *Events
}

type Events

type Events = map[string]func()

type NodeType

type NodeType uint32
const (
	TextNode NodeType = iota
	ElementNode
)

type Props

type Props = map[string]string

type VNode

type VNode struct {
	Type     NodeType
	TagName  string
	Attrs    *Attrs
	Children []*VNode
	// lifecycle
	OnCreate func() // invoked after element created and attached to the DOM (react: componentDidMount)
	OnUpdate func() // invoked after updating occurs, not called for the initial render (react: componentDidUpdate)
	OnRemove func() // invoked before element removed from the DOM and destroyed (react: componentWillUnmount)
	// key
	Key string // help identify nodes when updating the DOM
}

func H

func H(tagName string, attrs *Attrs, children ...*VNode) *VNode

hyperscript-style API: h(tagName, attrs, children)

func Text

func Text(text string) *VNode

func (*VNode) HashCode

func (vnode *VNode) HashCode() string

TODO

Jump to

Keyboard shortcuts

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