solidgo

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Window = struct {
	Document Document
	Body     Element
}{
	Document: Document{Js: js.Global().Get("document"),
		Body: Element(js.Global().Get("document").Get("body")),
	}}

Functions

func A

func A(name string) func(...ApplyToElement) func(...Appendable) Element

func CreateEffect

func CreateEffect(function func())

func CreateSignal

func CreateSignal[T any](defaultValue T) (func() T, func(T))

Types

type Appendable

type Appendable interface {
	AppendTo(Element)
}

type ApplyToElement

type ApplyToElement interface {
	Apply(Element)
}

type Attribute

type Attribute struct {
	Name   string
	Effect func() string
}

func At

func At(name string, effect func() string) Attribute

func (Attribute) Apply

func (attribute Attribute) Apply(element Element)

type Document

type Document struct {
	Js   js.Value
	Body Element
}

func (Document) CreateElement

func (document Document) CreateElement(name string) Element

func (Document) CreateTextNode

func (document Document) CreateTextNode(content string) Element

type Element

type Element js.Value

func For

func For(collection func() []interface{}, renderer func(index int) Element) Element

func ForG

func ForG[T any](collection func() []T, renderer func(item T) Element) Element

Generic implementation of For

func T

func T(effect func() string) Element

func (Element) AddEventListener

func (element Element) AddEventListener(name string, function func())

func (Element) AppendChild

func (element Element) AppendChild(value Element)

func (Element) AppendTo

func (element Element) AppendTo(parent Element)

func (Element) SetAttribute

func (element Element) SetAttribute(name, value string)

func (Element) SetInnerText

func (element Element) SetInnerText(value string)

type EventCallBack

type EventCallBack struct {
	Name     string
	Callback func()
}

func On

func On(event string, callback func()) EventCallBack

func (EventCallBack) Apply

func (event EventCallBack) Apply(element Element)

type ForStruct

type ForStruct[T comparable] struct {
	Collection func() []T
	Render     func(T) Element
}

func (ForStruct[T]) AppendTo

func (forR ForStruct[T]) AppendTo(parent Element)

type Signal

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

func (*Signal[T]) Get

func (signal *Signal[T]) Get() T

TODO panic when called outside effect

func (*Signal[T]) Set

func (signal *Signal[T]) Set(value T)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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