js

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: MIT Imports: 7 Imported by: 0

README

Dairaga JS (Experimental)

It is a experimental toolkit about GO Webassembly with GO 1.18. Therefore, it is incompatible with 1.11 and before.

Documentation

Rendered for js/wasm

Index

Constants

View Source
const (
	TypeUndefined = js.TypeUndefined
	TypeNull      = js.TypeNull
	TypeBoolean   = js.TypeBoolean
	TypeNumber    = js.TypeNumber
	TypeString    = js.TypeString
	TypeSymbol    = js.TypeSymbol
	TypeObject    = js.TypeObject
	TypeFunction  = js.TypeFunction
)

Variables

This section is empty.

Functions

func Alert

func Alert(a ...any)

func Alertf

func Alertf(format string, a ...any)

func Append

func Append(a Appendable)

func ArrayBufferToBytes

func ArrayBufferToBytes(src Value) []byte

func BindValue

func BindValue(elm any, name string, val *string, cb func(string, string))

func GoBytes

func GoBytes(src Value) []byte

func Prepend

func Prepend(a Appendable)

func Redirect

func Redirect(newURL string)

func RemoveChild

func RemoveChild(x any)

func Window

func Window() js.Value

Types

type Appendable

type Appendable interface {
	Wrapper
	Ref() Value
}

type Element

type Element interface {
	Appendable

	Tattoo() string

	Query(selector string) Element
	QueryAll(selector string) Elements

	Append(child Appendable, at ...string) Element
	Prepend(child Appendable, at ...string) Element

	Prop(p string, at ...string) Value
	SetProp(p string, val any, at ...string) Element

	Attr(a string, at ...string) string
	SetAttr(a, value string, at ...string) Element

	Text() string
	SetText(txt string) Element

	HTML() HTML
	SetHTML(html HTML) Element

	Value() string
	SetValue(val string) Element
	Files() []File

	Add(clz string, at ...string) Element
	Remove(clz string, at ...string) Element
	Has(clz string, at ...string) bool
	Replace(oldClz, newClz string, at ...string) Element
	Toggle(clz string, at ...string) Element

	On(typ string, fn func(sender Element), at ...string) Element
	OnClick(fn func(sender Element), at ...string) Element
	OnChange(fn func(sender Element), at ...string) Element

	Click(at ...string) Element
	Foucs(at ...string) Element
	Blur(at ...string) Element

	Empty() Element
	Relese()

	Trigger(name string) Element
	Bind(name string, val *string, cb func(string, string)) Element
}

func CreateElement

func CreateElement(tag string) Element

func ElementOf

func ElementOf(x any) Element

func Query

func Query(selector string) Element

type Elements

type Elements []Element

func ElementsOf

func ElementsOf(v Value) (ret Elements)

func QueryAll

func QueryAll(selector string) Elements

func (Elements) Add

func (e Elements) Add(clz string) Elements

func (Elements) Attr

func (lst Elements) Attr(a string) (ret []string)

Attr returns some attribute values.

func (Elements) Filter

func (lst Elements) Filter(p func(Element) bool) (ret Elements)

func (Elements) FilterNot

func (lst Elements) FilterNot(p func(Element) bool) Elements

func (Elements) Foreach

func (lst Elements) Foreach(fn func(int, Element))

func (Elements) Has

func (e Elements) Has(clz string) Elements

func (Elements) Length

func (lst Elements) Length() int

func (Elements) Prop

func (e Elements) Prop(p string) (ret []Value)

Prop returns some property values.

func (Elements) Remove

func (e Elements) Remove(clz string) Elements

func (Elements) Replace

func (e Elements) Replace(oldClz, newClz string) Elements

func (Elements) SetAttr

func (e Elements) SetAttr(a, val string) Elements

SetAttr sets attribute to all elements.

func (Elements) SetProp

func (e Elements) SetProp(a string, val Value) Elements

SetProp sets property to all elements.

func (Elements) SetValue

func (e Elements) SetValue(val string) Elements

func (Elements) Toggle

func (e Elements) Toggle(clz string) Elements

func (Elements) Value

func (e Elements) Value() (ret []string)

type File

type File Value

func FileOf

func FileOf(x any, opts ...string) File

func (File) JSValue

func (f File) JSValue() Value

func (File) LastModified

func (f File) LastModified() time.Time

func (File) Name

func (f File) Name() string

func (File) Type

func (f File) Type() string

func (File) WebkitRelativePath

func (f File) WebkitRelativePath() string

type Func

type Func = js.Func

func FuncOf

func FuncOf(fn JSFunc) Func

type HTML

type HTML string

func (HTML) JSValue

func (h HTML) JSValue() Value

type JSFunc

type JSFunc = func(Value, []Value) any

type Listener

type Listener map[string]Func

func (Listener) Add

func (l Listener) Add(target Value, typ string, fn JSFunc) Func

func (Listener) Release

func (l Listener) Release()

func (Listener) Remove

func (l Listener) Remove(target Value, typ string)

type Plain

type Plain string

func (Plain) JSValue

func (p Plain) JSValue() Value

func (Plain) Ref

func (p Plain) Ref() Value

type Type

type Type = js.Type

type Value

type Value = js.Value

func Null

func Null() Value

func Uint8Array

func Uint8Array(src []byte) Value

func Undefined

func Undefined() Value

func ValueOf

func ValueOf(x any) Value

type Wrapper

type Wrapper interface {
	JSValue() Value
}

Directories

Path Synopsis
xhr

Jump to

Keyboard shortcuts

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