hyperscript

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

Documentation

Index

Constants

View Source
const (
	NodeTypeUnknown     NodeType = 0
	NodeTypeElementNode          = 1
	NodeTypeTextNode             = 3
)

Variables

View Source
var (
	BlankElement   = Text("")
	BlankComponent = func(Object) VNode { return BlankElement }
)

Functions

func ObjectEqual

func ObjectEqual(a, b Object) bool

Types

type Component

type Component = func(props Object) VNode

type ElementNode

type ElementNode interface {
	VNode
	Name() string
	Children() VNodes
	Attributes() Object
}

type Func

type Func struct {
	Func *func(this Value, args []Value) interface{}
}

func FuncOf

func FuncOf(fn func(this Value, args []Value) interface{}) Func

func (Func) Call

func (c Func) Call(this Value, args []Value) interface{}

type NodeType

type NodeType int

func (NodeType) String

func (n NodeType) String() string

type Object

type Object map[string]interface{}

func ObjectDiff

func ObjectDiff(old, new Object) Object

func (Object) Bool

func (o Object) Bool(key string) bool

func (Object) Bools

func (o Object) Bools(key string) []bool

func (Object) Func

func (o Object) Func(key string) Func

func (Object) Funcs

func (o Object) Funcs(key string) []Func

func (Object) Get

func (o Object) Get(key string) interface{}

func (Object) Int

func (o Object) Int(key string) int

func (Object) Ints

func (o Object) Ints(key string) []int

func (Object) Key

func (o Object) Key() string

func (Object) Set

func (o Object) Set(key string, value interface{})

func (Object) String

func (o Object) String(key string) string

func (Object) Strings

func (o Object) Strings(key string) []string

type TextNode

type TextNode interface {
	VNode
	Content() string
}

func Text

func Text(t string) TextNode

type VNode

type VNode interface {
	NodeType() NodeType
	Reference() Value
	SetReference(Value)
}

func H

func H(tag interface{}, attrs Object, children ...VNode) VNode

type VNodes

type VNodes []VNode

type Value

type Value interface {
	Get(p string) Value
	Set(p string, x interface{})
	Index(i int) Value
	SetIndex(i int, x interface{})
	Length() int
	Call(m string, args ...interface{}) Value
	Invoke(args ...interface{}) Value
	New(args ...interface{}) Value
	Float() float64
	Int() int
	Bool() bool
	Truthy() bool
	String() string
	InstanceOf(t Value) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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