dom

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

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

Go to latest
Published: Jul 18, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MouseLeft = MouseButton(0)
)

Variables

View Source
var (
	Doc  = GetDocument()
	Body = Doc.GetElementsByTagName("body")[0]
)

Functions

func ConsoleLog

func ConsoleLog(args ...interface{})

func Loop

func Loop()

func RegisterEventType

func RegisterEventType(typ string, fnc EventConstructor)

Types

type Auto

type Auto struct{}

func (Auto) String

func (Auto) String() string

type BaseEvent

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

func (*BaseEvent) Bubbles

func (e *BaseEvent) Bubbles() bool

func (*BaseEvent) Cancelable

func (e *BaseEvent) Cancelable() bool

func (*BaseEvent) Composed

func (e *BaseEvent) Composed() bool

func (*BaseEvent) CurrentTarget

func (e *BaseEvent) CurrentTarget() *Element

func (*BaseEvent) DefaultPrevented

func (e *BaseEvent) DefaultPrevented() bool

func (*BaseEvent) IsTrusted

func (e *BaseEvent) IsTrusted() bool

func (*BaseEvent) JSRef

func (e *BaseEvent) JSRef() js.Ref

func (*BaseEvent) Path

func (e *BaseEvent) Path() NodeList

func (*BaseEvent) Target

func (e *BaseEvent) Target() *Element

func (*BaseEvent) Type

func (e *BaseEvent) Type() string

type Button

type Button struct {
	Element
}

func (*Button) OnClick

func (b *Button) OnClick(h EventHandler)

type Color

type Color string

type Document

type Document struct {
	NodeBase
}

func GetDocument

func GetDocument() *Document

func (*Document) CreateElement

func (d *Document) CreateElement(tag string) *Element

func (*Document) CreateElementNS

func (d *Document) CreateElementNS(ns string, tag string) *Element

func (*Document) GetElementsByTagName

func (d *Document) GetElementsByTagName(tag string) NodeList

func (*Document) NewButton

func (d *Document) NewButton(s string) *Button

func (*Document) NewInput

func (d *Document) NewInput(typ string) *Input

func (*Document) QuerySelector

func (d *Document) QuerySelector(qu string) *Element

func (*Document) QuerySelectorAll

func (d *Document) QuerySelectorAll(qu string) NodeList

type Element

type Element struct {
	NodeBase
}

func AsElement

func AsElement(v js.Value) *Element

func (*Element) GetAttribute

func (e *Element) GetAttribute(k string) js.Value

func (*Element) GetBoundingClientRect

func (e *Element) GetBoundingClientRect() Rect

func (*Element) OnClick

func (e *Element) OnClick(h MouseEventHandler)

func (*Element) OnMouseDown

func (e *Element) OnMouseDown(h MouseEventHandler)

func (*Element) OnMouseMove

func (e *Element) OnMouseMove(h MouseEventHandler)

func (*Element) OnMouseUp

func (e *Element) OnMouseUp(h MouseEventHandler)

func (*Element) SetAttribute

func (e *Element) SetAttribute(k string, v interface{})

func (*Element) SetInnerHTML

func (e *Element) SetInnerHTML(s string)

func (*Element) Style

func (e *Element) Style() *Style

type Em

type Em float64

func (Em) String

func (v Em) String() string

type Event

type Event interface {
	Value
	Bubbles() bool
	Cancelable() bool
	Composed() bool
	CurrentTarget() *Element
	DefaultPrevented() bool
	Target() *Element
	Type() string
	IsTrusted() bool
	Path() NodeList
}

type EventConstructor

type EventConstructor func(e BaseEvent) Event

type EventHandler

type EventHandler func(Event)

type EventTarget

type EventTarget interface {
	Value
	AddEventListener(typ string, h EventHandler)
}

type Input

type Input struct {
	Element
}

func (*Input) OnChange

func (inp *Input) OnChange(h EventHandler)

func (*Input) OnInput

func (inp *Input) OnInput(h EventHandler)

func (*Input) SetName

func (inp *Input) SetName(name string)

func (*Input) SetType

func (inp *Input) SetType(typ string)

func (*Input) SetValue

func (inp *Input) SetValue(val interface{})

func (*Input) Value

func (inp *Input) Value() string

type MouseButton

type MouseButton int

type MouseEvent

type MouseEvent struct {
	BaseEvent
}

func (*MouseEvent) AltKey

func (e *MouseEvent) AltKey() bool

func (*MouseEvent) Button

func (e *MouseEvent) Button() MouseButton

func (*MouseEvent) ClientPos

func (e *MouseEvent) ClientPos() Point

func (*MouseEvent) CtrlKey

func (e *MouseEvent) CtrlKey() bool

func (*MouseEvent) MetaKey

func (e *MouseEvent) MetaKey() bool

func (*MouseEvent) OffsetPos

func (e *MouseEvent) OffsetPos() Point

func (*MouseEvent) PagePos

func (e *MouseEvent) PagePos() Point

func (*MouseEvent) ScreenPos

func (e *MouseEvent) ScreenPos() Point

func (*MouseEvent) ShiftKey

func (e *MouseEvent) ShiftKey() bool

type MouseEventHandler

type MouseEventHandler func(*MouseEvent)

type Node

type Node interface {
	EventTarget

	BaseURI() string
	NodeName() string
	ChildNodes() NodeList
	ParentNode() Node
	ParentElement() *Element
	TextContent() string
	SetTextContent(s string)

	AppendChild(n Node)
	Contains(n Node) bool
	IsEqualNode(n Node) bool
	IsSameNode(n Node) bool
	RemoveChild(n Node) Node
	ReplaceChild(n, old Node) Node
}

type NodeBase

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

func (*NodeBase) AddEventListener

func (e *NodeBase) AddEventListener(typ string, h EventHandler)

func (*NodeBase) AddEventListenerFlags

func (e *NodeBase) AddEventListenerFlags(typ string, flags int, h EventHandler)

func (*NodeBase) AppendChild

func (e *NodeBase) AppendChild(n Node)

func (*NodeBase) BaseURI

func (e *NodeBase) BaseURI() string

func (*NodeBase) ChildNodes

func (e *NodeBase) ChildNodes() NodeList

func (*NodeBase) Contains

func (e *NodeBase) Contains(n Node) bool

func (*NodeBase) IsEqualNode

func (e *NodeBase) IsEqualNode(n Node) bool

func (*NodeBase) IsSameNode

func (e *NodeBase) IsSameNode(n Node) bool

func (*NodeBase) JSRef

func (e *NodeBase) JSRef() js.Ref

func (*NodeBase) NodeName

func (e *NodeBase) NodeName() string

func (*NodeBase) ParentElement

func (e *NodeBase) ParentElement() *Element

func (*NodeBase) ParentNode

func (e *NodeBase) ParentNode() Node

func (*NodeBase) Remove

func (e *NodeBase) Remove()

func (*NodeBase) RemoveChild

func (e *NodeBase) RemoveChild(n Node) Node

func (*NodeBase) ReplaceChild

func (e *NodeBase) ReplaceChild(n, old Node) Node

func (*NodeBase) SetTextContent

func (e *NodeBase) SetTextContent(s string)

func (*NodeBase) TextContent

func (e *NodeBase) TextContent() string

type NodeList

type NodeList []*Element

func AsNodeList

func AsNodeList(v js.Value) NodeList

type Perc

type Perc int

func (Perc) String

func (v Perc) String() string

type Point

type Point = image.Point

type Px

type Px int

func (Px) String

func (v Px) String() string

type Rect

type Rect = image.Rectangle

type Rem

type Rem int

func (Rem) String

func (v Rem) String() string

type Style

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

func (*Style) Set

func (s *Style) Set(k string, v interface{})

func (*Style) SetHeight

func (s *Style) SetHeight(v Unit)

func (*Style) SetMarginsRaw

func (s *Style) SetMarginsRaw(m string)

func (*Style) SetWidth

func (s *Style) SetWidth(v Unit)

type Unit

type Unit interface {
	String() string
}

type Value

type Value = js.JSRef

type Vh

type Vh int

func (Vh) String

func (v Vh) String() string

type Vmax

type Vmax int

func (Vmax) String

func (v Vmax) String() string

type Vmin

type Vmin int

func (Vmin) String

func (v Vmin) String() string

type Vw

type Vw int

func (Vw) String

func (v Vw) String() string

type Window

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

func GetWindow

func GetWindow() *Window

func (*Window) AddEventListener

func (w *Window) AddEventListener(typ string, h EventHandler)

func (*Window) JSRef

func (w *Window) JSRef() js.Ref

func (*Window) OnResize

func (w *Window) OnResize(fnc func(e Event))

Directories

Path Synopsis
cmd
app
extension

Jump to

Keyboard shortcuts

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