web

package module
v0.0.0-...-6f192c7 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Global   = js.Global()
	Document = Global.Get("document")
)

Functions

This section is empty.

Types

type App

type App struct {
	Container DOMElement
	Scope     Scope
	RootSpec  Spec

	Element *DOMElement
	Spec    Spec
}

func NewApp

func NewApp(args ...any) *App

func (*App) Update

func (a *App) Update()

type DOMElement

type DOMElement = JSValue

type ElementAttr

type ElementAttr [2]string

func A

func A(args ...any) (ret []ElementAttr)

type ElementSpec

type ElementSpec struct {
	Tag      string
	Attrs    []ElementAttr
	Children []Spec
}

func (ElementSpec) Patch

func (e ElementSpec) Patch(
	scope Scope,
	oldSpec Spec,
	oldElement *DOMElement,
	replace func(DOMElement),
) (
	newElement *DOMElement,
	newSpec Spec,
)

type FuncSpec

type FuncSpec struct {
	Func any
	Name string
}

func F

func F(fn any) *FuncSpec

func (*FuncSpec) GetName

func (f *FuncSpec) GetName() string

func (FuncSpec) Patch

func (f FuncSpec) Patch(
	scope Scope,
	oldSpec Spec,
	oldElement *DOMElement,
	replace func(DOMElement),
) (
	newElement *DOMElement,
	newSpec Spec,
)

func (*FuncSpec) SetName

func (f *FuncSpec) SetName(name string)

type HasName

type HasName interface {
	GetName() string
	SetName(string)
}

type JSValue

type JSValue = js.Value

type ObserverSpec

type ObserverSpec struct {
	Name         string
	ScopeVersion int
	Spec         Spec
}

func (ObserverSpec) NoChange

func (o ObserverSpec) NoChange(newScope Scope) bool

func (ObserverSpec) Patch

func (o ObserverSpec) Patch(
	scope Scope,
	oldSpec Spec,
	oldElement *DOMElement,
	replace func(DOMElement),
) (
	newElement *DOMElement,
	newSpec Spec,
)

type Scope

type Scope struct {
	Values  []map[reflect.Type]reflect.Value
	Version int
}

func NewScope

func NewScope(updates ...any) Scope

func (*Scope) Assign

func (s *Scope) Assign(targets ...any)

func (*Scope) AssignValue

func (s *Scope) AssignValue(target reflect.Value)

func (*Scope) Call

func (s *Scope) Call(fn any, targets ...any) []reflect.Value

func (*Scope) CallValue

func (s *Scope) CallValue(fn reflect.Value, targets ...any) []reflect.Value

func (Scope) Clone

func (s Scope) Clone() Scope

func (*Scope) Get

func (s *Scope) Get(t reflect.Type) (ret any, ok bool)

func (*Scope) GetValue

func (s *Scope) GetValue(t reflect.Type) (ret reflect.Value, ok bool)

func (*Scope) Set

func (s *Scope) Set(t reflect.Type, v any)

func (*Scope) SetValue

func (s *Scope) SetValue(t reflect.Type, v reflect.Value)

func (*Scope) Update

func (s *Scope) Update(fns ...any)

type Spec

type Spec interface {
	Patch(
		scope Scope,
		oldSpec Spec,
		oldElement *DOMElement,
		replace func(DOMElement),
	) (
		newElement *DOMElement,
		newSpec Spec,
	)
}

func E

func E(tag string, args ...any) Spec

func Named

func Named(name string, spec Spec) Spec

type TextSpec

type TextSpec string

func (TextSpec) Patch

func (t TextSpec) Patch(
	scope Scope,
	oldSpec Spec,
	oldElement *DOMElement,
	replace func(DOMElement),
) (
	newElement *DOMElement,
	newSpec Spec,
)

Jump to

Keyboard shortcuts

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