rview

package module
v0.0.0-...-c4d099b Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: MIT Imports: 11 Imported by: 0

README

developing...

开发中...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcExp

func CalcExp(exp *ddl.Exp, varGetter VarGetter) (*ddl.Exp, error)

func CompareInterface

func CompareInterface(a interface{}, b interface{}) bool

func ConvertVariableToExp

func ConvertVariableToExp(variable interface{}) (*ddl.Exp, error)

func GetStructField

func GetStructField(structVar interface{}, field string) (interface{}, error)

func IsStructFieldExported

func IsStructFieldExported(field string) bool

func RunAndWatch

func RunAndWatch(runWhat func(), fnOnChanged func(watcher *Watcher)) func()

func RunReactively

func RunReactively(runWhat func()) func()

func SetStructField

func SetStructField(structVar interface{}, field string, val interface{}) error

func ThrottledRunReactively

func ThrottledRunReactively(runWhat func(), d time.Duration) func()

func WatchRef

func WatchRef[T any](ref *Ref[T], fnOnChanged func(newVal, oldVal T), immediate bool) func()

func WatchRefs

func WatchRefs(refs []Watchable, fnOnChanged func(), immediate bool) func()

Types

type ActiveWatcherMgr

type ActiveWatcherMgr struct {
	// contains filtered or unexported fields
}

func (*ActiveWatcherMgr) ActiveWatcher

func (awm *ActiveWatcherMgr) ActiveWatcher() *Watcher

func (*ActiveWatcherMgr) Depth

func (awm *ActiveWatcherMgr) Depth() int

func (*ActiveWatcherMgr) Pop

func (awm *ActiveWatcherMgr) Pop() *Watcher

func (*ActiveWatcherMgr) Push

func (awm *ActiveWatcherMgr) Push(watcher *Watcher)

type ComponentNode

type ComponentNode struct {
	Comp        comp.Component
	Parent      *ComponentNode
	Children    []*ComponentNode
	Key         string
	TplNode     *ddl.TplNode
	Vars        map[string]interface{}
	InheritVars bool
	Ignore      bool
	HasIf       bool
	If          bool
	HasElseIf   bool
	ElseIf      bool
	HasElse     bool
	Else        bool
	HasFor      bool
}

type Page

type Page struct {
	Tpl               string
	TagCompCreatorMap map[string]func() comp.Component

	ErrChan chan error
	// contains filtered or unexported fields
}

func NewPage

func NewPage(def interface{}) (*Page, error)

type Ref

type Ref[T any] struct {
	// contains filtered or unexported fields
}

func Computed

func Computed[T any](fnCompute func() T) *Ref[T]

func NewRef

func NewRef[T any](t T) *Ref[T]

func (*Ref[T]) AddWatcher

func (r *Ref[T]) AddWatcher(watcher *Watcher)

func (*Ref[T]) Get

func (r *Ref[T]) Get() T

func (*Ref[T]) RemoveWatcher

func (r *Ref[T]) RemoveWatcher(watcher *Watcher)

func (*Ref[T]) Set

func (r *Ref[T]) Set(val T)

func (*Ref[T]) Trigger

func (r *Ref[T]) Trigger()

func (*Ref[T]) Type

func (r *Ref[T]) Type() reflect.Type

type VarGetter

type VarGetter func(name string) (interface{}, error)

a function that get a variable according to its name

type Watchable

type Watchable interface {
	AddWatcher(watcher *Watcher)
	RemoveWatcher(watcher *Watcher)
	Trigger()
}

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(watchWhat func(), doSomething func(Watchable, interface{}, interface{})) *Watcher

func (*Watcher) AddRef

func (w *Watcher) AddRef(ref Watchable)

func (*Watcher) RunAndWatch

func (w *Watcher) RunAndWatch()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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