web

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

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

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

View Source
const (
	ELEMENT__tag       = "tagName"
	ELEMENT__id        = "id"
	ELEMENT__class     = "className"
	ELEMENT__innerText = "innerText"

	FUNCTION__appendChild = "appendChild"

	PROPERTY__value = "value"

	FUNCTION__input_onfocus = "onfocus"
)
View Source
const (
	XHTTP__response = "response"
	XHTTP__error    = "Error"

	PROMISE        = "promise"
	PROMISE__then  = "then"
	PROMISE__catch = "catch"
)
View Source
const (
	WINDOW__location           = "location"
	FUNCTION__location_replace = "replace"

	FUNCTION__form_onsubmit       = "onsubmit"
	FUNCTION__form_preventDefault = "preventDefault"
)

Variables

View Source
var (
	GOWEB_ERROR_COMPONENT_VALS_NIL     = errors.New("component vals map nil")
	GOWEB_ERROR_INVALID_ATTRIBUTE_TYPE = errors.New("invalid component attribute type")
)

Functions

func NewXHTTPRequest

func NewXHTTPRequest(_type string, _url string, _async bool) (js.Value, error)

func ValidJSValue

func ValidJSValue(_name string, _v js.Value) error

Types

type Attribute

type Attribute struct {
	Type  string
	Value string
}

func (Attribute) String

func (a Attribute) String() string

type Component

type Component struct {
	Name string
	Vals map[string]Attribute
}

func (*Component) Mapped

func (c *Component) Mapped() (map[string]interface{}, error)

func (*Component) String

func (c *Component) String() string

type Element

type Element struct {
	js.Value
	Tag   string
	ID    string
	Class string

	Components map[string]*Component
}

func NewElement

func NewElement(_v js.Value) *Element

func (*Element) AddEventListener

func (elem *Element) AddEventListener(_eventName string, _cb js.Func) error

AddEventListener ...

func (*Element) Emit

func (elem *Element) Emit(_name string, _data map[string]interface{}, _bub bool)

Emit ...

func (*Element) GetAttribute

func (elem *Element) GetAttribute(_name string) (js.Value, error)

GetAttribute ...

func (*Element) GetCacheValue

func (elem *Element) GetCacheValue(_name string) (interface{}, error)

NOT IMPLEMENTED

func (*Element) GetProperty

func (elem *Element) GetProperty(_names ...string) (js.Value, error)

GetProperty ...

func (*Element) Parent

func (elem *Element) Parent() string

Parent ...

func (*Element) Remove

func (elem *Element) Remove() error

Remove ...

func (*Element) RemoveAttribute

func (elem *Element) RemoveAttribute(_compName string) error

RemoveAttribute ...

func (*Element) RemoveChildById

func (elem *Element) RemoveChildById(_id string) error

RemoveChildByID ...

func (*Element) SetAttribute

func (elem *Element) SetAttribute(_compName string, _vals map[string]interface{}) error

SetAttribute ...

func (*Element) SetAttributes

func (elem *Element) SetAttributes(_comps []Component) error

SetAttributes ...

func (*Element) SetChild

func (elem *Element) SetChild(_v js.Value) error

SetChild ...

func (*Element) SetClass

func (elem *Element) SetClass(_cn string) error

SetClass ...

func (*Element) SetID

func (elem *Element) SetID(_id string) error

SetID ...

func (*Element) SetProperty

func (elem *Element) SetProperty(_val interface{}, _names ...string) error

SetProperty ...

func (*Element) StoreCacheValue

func (elem *Element) StoreCacheValue(_name, _type string, _val interface{}) error

StoreCacheValue - NOT IMPLEMENTED

func (*Element) String

func (elem *Element) String() string

String ...

type Logger

type Logger struct {
	Prefix string
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger() *Logger

func (*Logger) Debug

func (l *Logger) Debug(_msg string)

func (*Logger) Error

func (l *Logger) Error(_err error)

func (*Logger) Info

func (l *Logger) Info(_msg string)

func (*Logger) Log

func (l *Logger) Log(_v ...interface{})

func (*Logger) LogElement

func (l *Logger) LogElement(_e *Element)

func (*Logger) LogValue

func (l *Logger) LogValue(_v js.Value)

func (*Logger) Print

func (l *Logger) Print(_msg string)

func (*Logger) Write

func (l *Logger) Write(p []byte) (int, error)

type Window

type Window struct {
	Title   string
	Version string

	*Logger
	// contains filtered or unexported fields
}

func NewWindow

func NewWindow() *Window

NewWindow ...

func (*Window) ElementById

func (w *Window) ElementById(_id string) *Element

ElementById ...

func (*Window) GetCookie

func (w *Window) GetCookie(_name string) (string, error)

GetCookie ...

func (*Window) GetElementByTag

func (w *Window) GetElementByTag(_tag string) (*Element, error)

GetElementByTag returns the first element in the document with the given tag (e.g. <div>, <a-entity>, etc.)

func (*Window) GetGlobal

func (w *Window) GetGlobal(_name string) (js.Value, error)

GetGlobal ...

func (*Window) GetValueById

func (w *Window) GetValueById(_id string) (js.Value, error)

GetValueById ...

func (*Window) NewElementWithTag

func (w *Window) NewElementWithTag(_tag string) *Element

NewElementWithTag ...

func (*Window) NewElementWithValue

func (w *Window) NewElementWithValue(_v js.Value) *Element

NewElementWithValue ...

func (*Window) RemoveElementById

func (w *Window) RemoveElementById(_id string)

RemoveElementById ...

func (*Window) SetCookie

func (w *Window) SetCookie(_name, _val string) error

SetCookie ...

func (*Window) SetGlobal

func (w *Window) SetGlobal(_name string, _val interface{}) error

SetGlobal ...

Jump to

Keyboard shortcuts

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