ujs

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

README

ujs

License

GNU

Documentation

Index

Constants

View Source
const (
	ELEMENT_NODE                = 1
	ATTRIBUTE_NODE              = 2
	TEXT_NODE                   = 3
	CDATA_SECTION_NODE          = 4
	PROCESSING_INSTRUCTION_NODE = 7
	COMMENT_NODE                = 8
	DOCUMENT_NODE               = 9
	DOCUMENT_TYPE_NODE          = 10
	DOCUMENT_FRAGMENT_NODE      = 11
)

Variables

View Source
var Document = &DocumentObject{EventTarget: NewEventTarget(&Object{js.Global().Get("document")})}
View Source
var Navigator = NewNavigatorObject(NewObject(js.Global().Get("navigator")))
View Source
var Window = &WindowObject{
	EventTarget:  NewEventTarget(&Object{js.Global().Get("window")}),
	localStorage: NewStorage(&Object{js.Global().Get("window").Get("localStorage")}),
}

Functions

func AnyArrayOf

func AnyArrayOf[T any](input []T) (output []any)

func CreateAnimator

func CreateAnimator(function AnimatorFunction)

func JSArrayOf

func JSArrayOf[T any](input []T) js.Value

func ProcessTemplate

func ProcessTemplate(node *Node, context any, funcmap template.FuncMap)

Types

type AnimatorFunction

type AnimatorFunction func(dt float64) (cancel bool)

type CanvasContext

type CanvasContext interface {
	GetCanvasElement() *HTMLCanvasElement
}

type Clipboard

type Clipboard struct {
	*EventTarget
}

func NewClipboard

func NewClipboard(object *Object) *Clipboard

func (*Clipboard) ReadText

func (n *Clipboard) ReadText() string

func (*Clipboard) WriteText

func (n *Clipboard) WriteText(value string)

type DOMTokenList

type DOMTokenList struct {
	*Object
}

func NewDOMTokenList

func NewDOMTokenList(object *Object) *DOMTokenList

func (*DOMTokenList) Add

func (l *DOMTokenList) Add(value string)

func (*DOMTokenList) Contains

func (l *DOMTokenList) Contains(value string) bool

func (*DOMTokenList) Entries

func (l *DOMTokenList) Entries() (entries []string)

func (*DOMTokenList) Item

func (l *DOMTokenList) Item(index int) string

func (*DOMTokenList) Remove

func (l *DOMTokenList) Remove(value string)

func (*DOMTokenList) Replace

func (l *DOMTokenList) Replace(old, new string)

func (*DOMTokenList) Toggle

func (l *DOMTokenList) Toggle(value string)

type DocumentObject

type DocumentObject struct {
	*EventTarget
}

func (*DocumentObject) Body

func (d *DocumentObject) Body() *HTMLElement

func (*DocumentObject) CreateElement

func (d *DocumentObject) CreateElement(name string) *Element

func (*DocumentObject) CreateElementNS

func (d *DocumentObject) CreateElementNS(namespace string, name string) *Element

func (*DocumentObject) GetElementByID

func (d *DocumentObject) GetElementByID(id string) *Element

func (*DocumentObject) GetElementsByTagName

func (e *DocumentObject) GetElementsByTagName(name string) (elements []*Element)

type Element

type Element struct {
	*Node
}

func CloneTemplate

func CloneTemplate(id string) *Element

func ElementFromNode

func ElementFromNode(node *Node) *Element

func GetTemplate

func GetTemplate(id string) *Element

func NewElement

func NewElement(object *Object) *Element

func (*Element) After

func (e *Element) After(other ...*Element)

func (*Element) Append

func (e *Element) Append(other ...*Element)

func (*Element) AsHTMLElement

func (e *Element) AsHTMLElement() *HTMLElement

func (*Element) AsHTMLInputElement

func (e *Element) AsHTMLInputElement() *HTMLInputElement

func (*Element) Before

func (e *Element) Before(other ...*Element)

func (*Element) ClassList

func (e *Element) ClassList() *DOMTokenList

func (*Element) ClientHeight

func (e *Element) ClientHeight() float64

func (*Element) ClientLeft

func (e *Element) ClientLeft() float64

func (*Element) ClientTop

func (e *Element) ClientTop() float64

func (*Element) ClientWidth

func (e *Element) ClientWidth() float64

func (*Element) GetAttribute

func (e *Element) GetAttribute(name string) string

func (*Element) InnerHTML

func (e *Element) InnerHTML() string

func (*Element) InnerText

func (e *Element) InnerText() string

func (*Element) Prepend

func (e *Element) Prepend(other ...*Element)

func (*Element) QuerySelector

func (e *Element) QuerySelector(query string) *Element

func (*Element) QuerySelectorAll

func (e *Element) QuerySelectorAll(query string) (elements []*Element)

func (*Element) ReadAttributes

func (e *Element) ReadAttributes(source any)

func (*Element) Remove

func (e *Element) Remove()

func (*Element) RemoveAttribute

func (e *Element) RemoveAttribute(name string)

func (*Element) ReplaceChildren

func (e *Element) ReplaceChildren(newChildren ...[]Element)

func (*Element) SetAttribute

func (e *Element) SetAttribute(name string, value any)

func (*Element) SetInnerHTML

func (e *Element) SetInnerHTML(value string)

func (*Element) SetInnerText

func (e *Element) SetInnerText(value string)

func (*Element) SetStyle

func (e *Element) SetStyle(style string)

func (*Element) WriteAttributes

func (e *Element) WriteAttributes(target any)

type Event

type Event struct {
	*Object
}

func NewEvent

func NewEvent(object *Object) *Event

func (*Event) Code

func (e *Event) Code() string

func (*Event) PreventDefault

func (e *Event) PreventDefault()

func (*Event) Target

func (e *Event) Target() *EventTarget

type EventListener

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

func (*EventListener) Remove

func (l *EventListener) Remove()

type EventTarget

type EventTarget struct {
	*Object
}

func NewEventTarget

func NewEventTarget(object *Object) *EventTarget

func (*EventTarget) AddEventListener

func (o *EventTarget) AddEventListener(event string, callback JSFunction) (listener *EventListener)

func (*EventTarget) RemoveEventListener

func (o *EventTarget) RemoveEventListener(event string, listener *EventListener)

type HTMLButtonElement

type HTMLButtonElement struct {
	*HTMLElement
}

func NewHTMLButtonElement

func NewHTMLButtonElement(object *Object) *HTMLButtonElement

func (*HTMLButtonElement) Disabled

func (e *HTMLButtonElement) Disabled() bool

func (*HTMLButtonElement) SetDisabled

func (e *HTMLButtonElement) SetDisabled(value bool)

type HTMLCanvasElement

type HTMLCanvasElement struct {
	*HTMLElement
}

func NewHTMLCanvasElement

func NewHTMLCanvasElement(object *Object) *HTMLCanvasElement

func (*HTMLCanvasElement) GetWebGL2Context

func (e *HTMLCanvasElement) GetWebGL2Context() *WebGL2RenderingContext

func (*HTMLCanvasElement) GetWebGLContext

func (e *HTMLCanvasElement) GetWebGLContext() *WebGLRenderingContext

func (*HTMLCanvasElement) Height

func (e *HTMLCanvasElement) Height() int

func (*HTMLCanvasElement) Width

func (e *HTMLCanvasElement) Width() int

type HTMLElement

type HTMLElement struct {
	*Element
}

func GetHTMLTemplate

func GetHTMLTemplate(id string) *HTMLElement

func NewHTMLElement

func NewHTMLElement(object *Object) *HTMLElement

type HTMLInputElement

type HTMLInputElement struct {
	*HTMLElement
}

func NewHTMLInputElement

func NewHTMLInputElement(object *Object) *HTMLInputElement

func (*HTMLInputElement) Disabled

func (e *HTMLInputElement) Disabled() bool

func (*HTMLInputElement) SetDisabled

func (e *HTMLInputElement) SetDisabled(value bool)

func (*HTMLInputElement) SetValue

func (e *HTMLInputElement) SetValue(value any)

func (*HTMLInputElement) Value

func (e *HTMLInputElement) Value() string

type JSFunction

type JSFunction func(this js.Value, args []js.Value) any

type KeyboardEvent

type KeyboardEvent struct {
	*UIEvent
}

func NewKeyboardEvent

func NewKeyboardEvent(object *Object) *KeyboardEvent

type LocationObject

type LocationObject struct {
	*Object
}

func (*LocationObject) HRef

func (o *LocationObject) HRef() string

func (*LocationObject) Hash

func (o *LocationObject) Hash() string

func (*LocationObject) Host

func (o *LocationObject) Host() string

func (*LocationObject) Hostname

func (o *LocationObject) Hostname() string

func (*LocationObject) MustQuery

func (o *LocationObject) MustQuery() url.Values

func (*LocationObject) Origin

func (o *LocationObject) Origin() string

func (*LocationObject) Pathname

func (o *LocationObject) Pathname() string

func (*LocationObject) Port

func (o *LocationObject) Port() string

func (*LocationObject) Query

func (o *LocationObject) Query() (values url.Values, err error)

func (*LocationObject) Search

func (o *LocationObject) Search() string

func (*LocationObject) SetHRef

func (o *LocationObject) SetHRef(value string)

func (*LocationObject) SetHash

func (o *LocationObject) SetHash(value string)

func (*LocationObject) SetHost

func (o *LocationObject) SetHost(value string)

func (*LocationObject) SetHostname

func (o *LocationObject) SetHostname(value string)

func (*LocationObject) SetPathname

func (o *LocationObject) SetPathname(value string)

func (*LocationObject) SetPort

func (o *LocationObject) SetPort(value string)

func (*LocationObject) SetSearch

func (o *LocationObject) SetSearch(value string)
type NavigatorObject struct {
	*Object
}

func NewNavigatorObject

func NewNavigatorObject(object *Object) *NavigatorObject
func (s *NavigatorObject) Clipboard() *Clipboard

type Node

type Node struct {
	*EventTarget
}

func ConvertNodeList

func ConvertNodeList(list js.Value) (nodes []*Node)

func NewNode

func NewNode(object *Object) *Node

func (*Node) AppendChild

func (n *Node) AppendChild(child *Node)

-- methods

func (*Node) BaseURI

func (n *Node) BaseURI() string

func (*Node) ChildNodes

func (n *Node) ChildNodes() *NodeList

func (*Node) CloneNode

func (n *Node) CloneNode(deep bool) *Node

func (*Node) CompareDocumentPosition

func (n *Node) CompareDocumentPosition(other *Node) int

func (*Node) Contains

func (n *Node) Contains(other *Node) bool

func (*Node) FirstChild

func (n *Node) FirstChild() *Node

func (*Node) GetRootNode

func (n *Node) GetRootNode() *Node

func (*Node) HasChildNodes

func (n *Node) HasChildNodes() bool

func (*Node) InsertBefore

func (n *Node) InsertBefore(node *Node, reference *Node)

func (*Node) IsConnected

func (n *Node) IsConnected() bool

func (*Node) IsDefaultNamespace

func (n *Node) IsDefaultNamespace(namespace string) bool

func (*Node) IsEqualNode

func (n *Node) IsEqualNode(other *Node) bool

func (*Node) IsSameNode

func (n *Node) IsSameNode(other *Node) bool

func (*Node) LastChild

func (n *Node) LastChild() *Node

func (*Node) NextSibling

func (n *Node) NextSibling() *Node

func (*Node) NodeName

func (n *Node) NodeName() string

func (*Node) NodeType

func (n *Node) NodeType() int

func (*Node) NodeValue

func (n *Node) NodeValue() string

func (*Node) OwnerDocument

func (n *Node) OwnerDocument() *DocumentObject

func (*Node) ParentElement

func (n *Node) ParentElement() *Element

func (*Node) ParentNode

func (n *Node) ParentNode() *Node

func (*Node) PreviousSibling

func (n *Node) PreviousSibling() *Node

func (*Node) RemoveChild

func (n *Node) RemoveChild(child *Node)

func (*Node) ReplaceChild

func (n *Node) ReplaceChild(newChild *Node, oldChild *Node)

func (*Node) SetNodeValue

func (n *Node) SetNodeValue(value string)

func (*Node) SetTextContent

func (n *Node) SetTextContent(value string)

func (*Node) TextContent

func (n *Node) TextContent() string

type NodeList

type NodeList struct {
	*Object
}

func (*NodeList) Item

func (l *NodeList) Item(index int) *Node

func (*NodeList) Length

func (l *NodeList) Length() int

func (*NodeList) Nodes

func (l *NodeList) Nodes() (nodes []*Node)

type Object

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

func NewObject

func NewObject(value js.Value) *Object

func (*Object) JSValue

func (o *Object) JSValue() js.Value

type Storage

type Storage struct {
	*Object
}

func NewStorage

func NewStorage(object *Object) *Storage

func (*Storage) Clear

func (s *Storage) Clear()

func (*Storage) GetItem

func (s *Storage) GetItem(key string) string

func (*Storage) Key

func (s *Storage) Key(index int) string

func (*Storage) Length

func (s *Storage) Length() int

func (*Storage) RemoveItem

func (s *Storage) RemoveItem(key string)

func (*Storage) SetItem

func (s *Storage) SetItem(key string, value string)

type UIEvent

type UIEvent struct {
	*Event
}

func NewUIEvent

func NewUIEvent(object *Object) *UIEvent

type WebGL2RenderingContext

type WebGL2RenderingContext struct {
	*WebGLRenderingContext
}

func (*WebGL2RenderingContext) CreateVertexArray

func (c *WebGL2RenderingContext) CreateVertexArray() *WebGLVertexArrayObject

type WebGLBuffer

type WebGLBuffer struct {
	*Object
}

func NewWebGLBuffer

func NewWebGLBuffer(value js.Value) *WebGLBuffer

type WebGLProgram

type WebGLProgram struct {
	*Object
}

func NewWebGLProgram

func NewWebGLProgram(value js.Value) *WebGLProgram

type WebGLRenderingContext

type WebGLRenderingContext struct {
	*Object
	// contains filtered or unexported fields
}

func (*WebGLRenderingContext) ActiveTexture

func (c *WebGLRenderingContext) ActiveTexture(unit uint32)

func (*WebGLRenderingContext) AttachShader

func (c *WebGLRenderingContext) AttachShader(program *WebGLProgram, shader *WebGLShader)

func (*WebGLRenderingContext) BindBuffer

func (c *WebGLRenderingContext) BindBuffer(target uint32, buffer *WebGLBuffer)

func (*WebGLRenderingContext) BindTexture

func (c *WebGLRenderingContext) BindTexture(target uint32, texture *WebGLTexture)

func (*WebGLRenderingContext) BindVertexArray

func (c *WebGLRenderingContext) BindVertexArray(vao *WebGLVertexArrayObject)

func (*WebGLRenderingContext) BufferData

func (c *WebGLRenderingContext) BufferData(target uint32, size int, data js.Value, usage uint32)

func (*WebGLRenderingContext) BufferSubData

func (c *WebGLRenderingContext) BufferSubData(target uint32, offset int, size int, data js.Value)

func (*WebGLRenderingContext) Clear

func (c *WebGLRenderingContext) Clear(target uint32)

func (*WebGLRenderingContext) ClearColor

func (c *WebGLRenderingContext) ClearColor(r, g, b, a float32)

func (*WebGLRenderingContext) ClearDepth

func (c *WebGLRenderingContext) ClearDepth(depth float64)

func (*WebGLRenderingContext) CompileShader

func (c *WebGLRenderingContext) CompileShader(shader *WebGLShader)

func (*WebGLRenderingContext) CreateBuffer

func (c *WebGLRenderingContext) CreateBuffer() *WebGLBuffer

func (*WebGLRenderingContext) CreateProgram

func (c *WebGLRenderingContext) CreateProgram() *WebGLProgram

func (*WebGLRenderingContext) CreateShader

func (c *WebGLRenderingContext) CreateShader(kind uint32) *WebGLShader

func (*WebGLRenderingContext) CreateTexture

func (c *WebGLRenderingContext) CreateTexture() *WebGLTexture

func (*WebGLRenderingContext) CullFace

func (c *WebGLRenderingContext) CullFace(mode uint32)

func (*WebGLRenderingContext) DepthFunc

func (c *WebGLRenderingContext) DepthFunc(xfnc uint32)

func (*WebGLRenderingContext) DisableVertexAttribArray

func (c *WebGLRenderingContext) DisableVertexAttribArray(index int)

func (*WebGLRenderingContext) DrawElements

func (c *WebGLRenderingContext) DrawElements(mode uint32, count int32, xtype uint32, offset int)

func (*WebGLRenderingContext) Enable

func (c *WebGLRenderingContext) Enable(cap uint32)

func (*WebGLRenderingContext) EnableVertexAttribArray

func (c *WebGLRenderingContext) EnableVertexAttribArray(index int)

func (*WebGLRenderingContext) FrontFace

func (c *WebGLRenderingContext) FrontFace(mode uint32)

func (*WebGLRenderingContext) GetCanvasElement

func (c *WebGLRenderingContext) GetCanvasElement() *HTMLCanvasElement

func (*WebGLRenderingContext) GetProgramInfoLog

func (c *WebGLRenderingContext) GetProgramInfoLog(program *WebGLProgram) string

func (*WebGLRenderingContext) GetShaderInfoLog

func (c *WebGLRenderingContext) GetShaderInfoLog(shader *WebGLShader) string

func (*WebGLRenderingContext) GetShaderParameter

func (c *WebGLRenderingContext) GetShaderParameter(shader *WebGLShader, pname uint32) js.Value

func (*WebGLRenderingContext) GetUniformLocation

func (c *WebGLRenderingContext) GetUniformLocation(program *WebGLProgram, name string) js.Value

func (*WebGLRenderingContext) LinkProgram

func (c *WebGLRenderingContext) LinkProgram(program *WebGLProgram)

func (*WebGLRenderingContext) ShaderSource

func (c *WebGLRenderingContext) ShaderSource(shader *WebGLShader, source string)

func (*WebGLRenderingContext) TexImage2D

func (c *WebGLRenderingContext) TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, border int32, format uint32, xtype uint32, pixels js.Value)

func (*WebGLRenderingContext) TexParameteri

func (c *WebGLRenderingContext) TexParameteri(target uint32, pname uint32, param int32)

func (*WebGLRenderingContext) Uniform1f

func (c *WebGLRenderingContext) Uniform1f(location js.Value, value float32)

func (*WebGLRenderingContext) Uniform1fv

func (c *WebGLRenderingContext) Uniform1fv(location js.Value, value []float32)

func (*WebGLRenderingContext) Uniform1i

func (c *WebGLRenderingContext) Uniform1i(location js.Value, value int32)

func (*WebGLRenderingContext) Uniform2f

func (c *WebGLRenderingContext) Uniform2f(location js.Value, v1, v2 float32)

func (*WebGLRenderingContext) Uniform3f

func (c *WebGLRenderingContext) Uniform3f(location js.Value, v1, v2, v3 float32)

func (*WebGLRenderingContext) Uniform3fv

func (c *WebGLRenderingContext) Uniform3fv(location js.Value, value []float32)

func (*WebGLRenderingContext) Uniform4f

func (c *WebGLRenderingContext) Uniform4f(location js.Value, v1, v2, v3, v4 float32)

func (*WebGLRenderingContext) UniformMatrix4fv

func (c *WebGLRenderingContext) UniformMatrix4fv(location js.Value, transpose bool, value []float32)

func (*WebGLRenderingContext) UseProgram

func (c *WebGLRenderingContext) UseProgram(program *WebGLProgram)

func (*WebGLRenderingContext) VertexAttribPointer

func (c *WebGLRenderingContext) VertexAttribPointer(index int, size int, xtype uint32, normalized bool, stride int32, offset int)

type WebGLShader

type WebGLShader struct {
	*Object
}

func NewWebGLShader

func NewWebGLShader(value js.Value) *WebGLShader

type WebGLTexture

type WebGLTexture struct {
	*Object
}

func NewWebGLTexture

func NewWebGLTexture(value js.Value) *WebGLTexture

type WebGLVertexArrayObject

type WebGLVertexArrayObject struct {
	*Object
}

func NewWebGLVertexArrayObject

func NewWebGLVertexArrayObject(value js.Value) *WebGLVertexArrayObject

type WindowObject

type WindowObject struct {
	*EventTarget
	// contains filtered or unexported fields
}

func (*WindowObject) ClearInterval

func (w *WindowObject) ClearInterval(id int)

func (*WindowObject) ClearTimeout

func (w *WindowObject) ClearTimeout(id int)

func (*WindowObject) LocalStorage

func (w *WindowObject) LocalStorage() *Storage

func (*WindowObject) Location

func (w *WindowObject) Location() *LocationObject

func (*WindowObject) Open

func (w *WindowObject) Open(url, target string)

func (*WindowObject) RequestAnimationFrame

func (w *WindowObject) RequestAnimationFrame(callback JSFunction)

func (*WindowObject) SetInterval

func (w *WindowObject) SetInterval(callback JSFunction, millis int) int

func (*WindowObject) SetTimeout

func (w *WindowObject) SetTimeout(callback JSFunction, millis int) int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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