wasm

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 4 Imported by: 1

README

wasm

WASM Golang helper

Documentation

Overview

Package wasm is a WASM helper for Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dbg

func Dbg(v js.Value) string

Dbg returns a human-readable representation of a js.Value, useful for debugging.

Types

type ClassList added in v0.0.2

type ClassList js.Value

ClassList represents CSS class list of an element.

func GetClassList

func GetClassList(obj js.Value) ClassList

GetClassList returns a ClassList of the object.

func (ClassList) Add added in v0.0.2

func (c ClassList) Add(s string)

Add adds the class to the class list.

func (ClassList) Contains added in v0.0.2

func (c ClassList) Contains(s string) bool

Contains returns true if a class list contains the specific class.

func (ClassList) Remove added in v0.0.2

func (c ClassList) Remove(s string)

Remove removes the class from the class list.

func (ClassList) String added in v0.0.2

func (c ClassList) String() string

String returns the string representation of the class list.

type DocHolder

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

DocHolder is a main entry object. Create it by calling GetDoc().

func GetDoc

func GetDoc() (*DocHolder, error)

func (*DocHolder) CreateElement

func (g *DocHolder) CreateElement(typ string) js.Value

func (*DocHolder) GetElementByID

func (g *DocHolder) GetElementByID(id string) (js.Value, error)

type EventListener

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

EventListener is an event listener.

func NewEventListener

func NewEventListener(evt string, fn func(js.Value, js.Value) any) *EventListener

NewEventListener creates a new event listener.

func (*EventListener) Add

func (e *EventListener) Add(elt js.Value)

Add adds the event listener to a JS object.

func (*EventListener) Remove

func (e *EventListener) Remove(elt js.Value)

Remove removes the event listener from a JS object.

Jump to

Keyboard shortcuts

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