dom

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

README

Go DOM binding (and more) for WebAssembly

Forked from dennwc/dom

With picks from gascore/dom

This library provides a Go API for different Web APIs for WebAssembly target.

It's in an active development, but an API will be carefully versioned to avoid breaking users. Use Go dependency management tools to lock a specific version.

More information about Go's WebAssembly support can be found on Go's WebAssembly wiki page.

Features:

  • Better JS API (wrappers for syscall/js)
  • Basic DOM manipulation, styles, events
  • Input elements
  • SVG elements and transforms
  • LocalStorage and SessionStorage
  • Extension APIs (tested on Chrome):
    • Native Messaging
    • Bookmarks
    • Tabs
  • net-like library for WebSockets
    • Tested with gRPC

Quickstart

Pull the library

go get -u github.com/go-goak/dom

Similar Projects

Editor Configuration

If you are using Visual Studio Code, you can use workspace settings to configure the environment variables for the go tools.

Your settings.json file should look something like this:

{
    "go.toolsEnvVars": { "GOARCH": "wasm", "GOOS": "js" }
}

Documentation

Index

Constants

View Source
const (
	MouseLeft = MouseButton(0)
)

Variables

View Source
var (
	Doc  = GetDocument()
	Body = getFirstWithTag("body")
	Head = getFirstWithTag("head")
)

Functions

func ConsoleLog

func ConsoleLog(args ...interface{})

func Loop

func Loop()

func RegisterEventType

func RegisterEventType(typ string, fnc EventConstructor)

Types

type AttachShadowOpts

type AttachShadowOpts struct {
	Open           bool
	DeligatesFocus bool
}

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) ButtonAttr

func (e *BaseEvent) ButtonAttr() string

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) JSValue

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

func (*BaseEvent) Key

func (e *BaseEvent) Key() string

func (*BaseEvent) KeyCode

func (e *BaseEvent) KeyCode() string

func (*BaseEvent) Path

func (e *BaseEvent) Path() NodeList

func (*BaseEvent) PreventDefault

func (e *BaseEvent) PreventDefault()

func (*BaseEvent) StopImmediatePropagation

func (e *BaseEvent) StopImmediatePropagation()

func (*BaseEvent) StopPropagation

func (e *BaseEvent) StopPropagation()

func (*BaseEvent) Target

func (e *BaseEvent) Target() *Element

func (*BaseEvent) Type

func (e *BaseEvent) Type() string

type Button

type Button struct {
	Element
}

func NewButton

func NewButton(s string) *Button

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) GetElementById

func (d *Document) GetElementById(id 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 NewElement

func NewElement(tag string) *Element

func (*Element) AsHTMLElement

func (e *Element) AsHTMLElement() *HTMLElement

func (*Element) AttachShadow

func (e *Element) AttachShadow(opts AttachShadowOpts) *ShadowRoot

func (*Element) ClassList

func (e *Element) ClassList() *TokenList

ClassList returns a DOMTokenList containing the list of class attributes.

func (*Element) ClassName

func (e *Element) ClassName() string

ClassName is a DOMString representing the class of the element.

func (*Element) ClientHeight

func (e *Element) ClientHeight() int

ClientHeight returns a Number representing the inner height of the element.

func (*Element) ClientLeft

func (e *Element) ClientLeft() int

ClientLeft returns a Number representing the width of the left border of the element.

func (*Element) ClientTop

func (e *Element) ClientTop() int

ClientTop returns a Number representing the width of the top border of the element.

func (*Element) ClientWidth

func (e *Element) ClientWidth() int

ClientWidth returns a Number representing the inner width of the element.

func (*Element) ComputedName

func (e *Element) ComputedName() string

ComputedName returns a DOMString containing the label exposed to accessibility.

func (*Element) ComputedRole

func (e *Element) ComputedRole() string

ComputedRole returns a DOMString containing the ARIA role that has been applied to a particular element.

func (*Element) GetAttribute

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

func (*Element) GetBoundingClientRect

func (e *Element) GetBoundingClientRect() Rect

func (*Element) Id

func (e *Element) Id() string

Id is a DOMString representing the id of the element.

func (*Element) InnerHTML

func (e *Element) InnerHTML() string

InnerHTML is a DOMString representing the markup of the element's content.

func (*Element) InsertAdjacentElement

func (e *Element) InsertAdjacentElement(position Position, newElement *Element) js.Value

InsertAdjacentElement inserts a given element node at a given position relative to the element it is invoked upon.

func (*Element) LocalName

func (e *Element) LocalName() string

LocalName a DOMString representing the local part of the qualified name of the element.

func (*Element) NamespaceURI

func (e *Element) NamespaceURI() string

NamespaceURI the namespace URI of the element, or null if it is no namespace.

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) OuterHTML

func (e *Element) OuterHTML() string

OuterHTML is a DOMString representing the markup of the element including its content. When used as a setter, replaces the element with nodes parsed from the given string.

func (*Element) Prefix

func (e *Element) Prefix() string

Prefix a DOMString representing the namespace prefix of the element, or null if no prefix is specified.

func (*Element) RemoveAttribute

func (e *Element) RemoveAttribute(k string)

func (*Element) ScrollHeight

func (e *Element) ScrollHeight() int

ScrollHeight returns a Number representing the scroll view height of an element.

func (*Element) ScrollLeft

func (e *Element) ScrollLeft() int

ScrollLeft is a Number representing the left scroll offset of the element.

func (*Element) ScrollLeftMax

func (e *Element) ScrollLeftMax() int

ScrollLeftMax returns a Number representing the maximum left scroll offset possible for the element.

func (*Element) ScrollTop

func (e *Element) ScrollTop() int

ScrollTop a Number representing number of pixels the top of the document is scrolled vertically.

func (*Element) ScrollTopMax

func (e *Element) ScrollTopMax() int

ScrollTopMax returns a Number representing the maximum top scroll offset possible for the element.

func (*Element) ScrollWidth

func (e *Element) ScrollWidth() int

ScrollWidth returns a Number representing the scroll view width of the element.

func (*Element) SetAttribute

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

func (*Element) SetClassName

func (e *Element) SetClassName(v string)

SetClassName is a DOMString representing the class of the element.

func (*Element) SetId

func (e *Element) SetId(v string)

SetId is a DOMString representing the id of the element.

func (*Element) SetInnerHTML

func (e *Element) SetInnerHTML(v string)

SetInnerHTML is a DOMString representing the markup of the element's content.

func (*Element) SetOuterHTML

func (e *Element) SetOuterHTML(v string)

SetOuterHTML is a DOMString representing the markup of the element including its content. When used as a setter, replaces the element with nodes parsed from the given string.

func (*Element) SetScrollLeft

func (e *Element) SetScrollLeft(v int)

SetScrollLeft is a Number representing the left scroll offset of the element.

func (*Element) SetScrollTop

func (e *Element) SetScrollTop(v int)

SetScrollTop a Number representing number of pixels the top of the document is scrolled vertically.

func (*Element) SetSlot

func (e *Element) SetSlot(v string)

SetSlot returns the name of the shadow DOM slot the element is inserted in.

func (*Element) SetTabStop

func (e *Element) SetTabStop(v bool)

SetTabStop is a Boolean indicating if the element can receive input focus via the tab key.

func (*Element) SetUndoScope

func (e *Element) SetUndoScope(v bool)

SetUndoScope is a Boolean indicating if the element is an undo scope host, or not.

func (*Element) ShadowRoot

func (e *Element) ShadowRoot() *ShadowRoot

Shadow returns the open shadow root that is hosted by the element, or null if no open shadow root is present.

func (*Element) Slot

func (e *Element) Slot() string

Slot returns the name of the shadow DOM slot the element is inserted in.

func (*Element) TabStop

func (e *Element) TabStop() bool

TabStop is a Boolean indicating if the element can receive input focus via the tab key.

func (*Element) TagName

func (e *Element) TagName() string

TagName returns a String with the name of the tag for the given element.

func (*Element) UndoManager

func (e *Element) UndoManager() js.Value

UndoManager returns the UndoManager associated with the element.

func (*Element) UndoScope

func (e *Element) UndoScope() bool

UndoScope is a Boolean indicating if the element is an undo scope host, or not.

type Em

type Em float64

func (Em) String

func (v Em) String() string

type Event

type Event interface {
	js.Wrapper
	Bubbles() bool
	Cancelable() bool
	Composed() bool
	CurrentTarget() *Element
	DefaultPrevented() bool
	Target() *Element
	Type() string
	IsTrusted() bool
	Path() NodeList
	Key() string
	KeyCode() string
	ButtonAttr() string

	PreventDefault()
	StopPropagation()
	StopImmediatePropagation()
}

func ConvertEvent

func ConvertEvent(v js.Value) Event

type EventConstructor

type EventConstructor func(e BaseEvent) Event

type EventHandler

type EventHandler func(Event)

type EventTarget

type EventTarget interface {
	js.Wrapper
	AddEventListener(typ string, h EventHandler)
}

type HTMLElement

type HTMLElement struct {
	Element
}

func (*HTMLElement) AccessKey

func (e *HTMLElement) AccessKey() string

AccessKey is a DOMString representing the access key assigned to the element.

func (*HTMLElement) AccessKeyLabel

func (e *HTMLElement) AccessKeyLabel() string

AccessKeyLabel returns a DOMString containing the element's assigned access key.

func (*HTMLElement) ContentEditable

func (e *HTMLElement) ContentEditable() string

ContentEditable is a DOMString, where a value of "true" means the element is editable and a value of "false" means it isn't.

func (*HTMLElement) Dataset

func (e *HTMLElement) Dataset() js.Value

Dataset returns a DOMStringMap with which script can read and write the element's custom data attributes (data-*) .

func (*HTMLElement) Dir

func (e *HTMLElement) Dir() string

Dir is a DOMString, reflecting the dir global attribute, representing the directionality of the element. Possible values are "ltr", "rtl", and "auto".

func (*HTMLElement) Draggable

func (e *HTMLElement) Draggable() bool

Draggable is a Boolean indicating if the element can be dragged.

func (*HTMLElement) Dropzone

func (e *HTMLElement) Dropzone() *TokenList

Dropzone returns a DOMSettableTokenList reflecting the dropzone global attribute and describing the behavior of the element regarding a drop operation.

func (*HTMLElement) Hidden

func (e *HTMLElement) Hidden() bool

Hidden is a Boolean indicating if the element is hidden or not.

func (*HTMLElement) Inert

func (e *HTMLElement) Inert() bool

Inert is a Boolean indicating whether the user agent must act as though the given node is absent for the purposes of user interaction events, in-page text searches ("find in page"), and text selection.

func (*HTMLElement) InnerText

func (e *HTMLElement) InnerText() string

InnerText represents the "rendered" text content of a node and its descendants. As a getter, it approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied it to the clipboard.

func (*HTMLElement) IsContentEditable

func (e *HTMLElement) IsContentEditable() bool

IsContentEditable returns a Boolean that indicates whether or not the content of the element can be edited.

func (*HTMLElement) ItemId

func (e *HTMLElement) ItemId() string

ItemId is a DOMString representing the item ID.

func (*HTMLElement) ItemProp

func (e *HTMLElement) ItemProp() *TokenList

ItemProp returns a DOMSettableTokenList…

func (*HTMLElement) ItemRef

func (e *HTMLElement) ItemRef() *TokenList

ItemRef returns a DOMSettableTokenList…

func (*HTMLElement) ItemScope

func (e *HTMLElement) ItemScope() bool

ItemScope is a Boolean representing the item scope.

func (*HTMLElement) ItemType

func (e *HTMLElement) ItemType() *TokenList

ItemType returns a DOMSettableTokenList…

func (*HTMLElement) ItemValue

func (e *HTMLElement) ItemValue() js.Value

ItemValue returns a Object representing the item value.

func (*HTMLElement) Lang

func (e *HTMLElement) Lang() string

Lang is a DOMString representing the language of an element's attributes, text, and element contents.

func (*HTMLElement) NoModule

func (e *HTMLElement) NoModule() bool

NoModule is a Boolean indicating whether an import script can be executed in user agents that support module scripts.

func (*HTMLElement) Nonce

func (e *HTMLElement) Nonce() js.Value

Nonce returns the cryptographic number used once that is used by Content Security Policy to determine whether a given fetch will be allowed to proceed.

func (*HTMLElement) OffsetHeight

func (e *HTMLElement) OffsetHeight() float64

OffsetHeight returns a double containing the height of an element, relative to the layout.

func (*HTMLElement) OffsetLeft

func (e *HTMLElement) OffsetLeft() float64

OffsetLeft returns a double, the distance from this element's left border to its offsetParent's left border.

func (*HTMLElement) OffsetParent

func (e *HTMLElement) OffsetParent() *Element

OffsetParent returns a Element that is the element from which all offset calculations are currently computed.

func (*HTMLElement) OffsetTop

func (e *HTMLElement) OffsetTop() float64

OffsetTop returns a double, the distance from this element's top border to its offsetParent's top border.

func (*HTMLElement) OffsetWidth

func (e *HTMLElement) OffsetWidth() float64

OffsetWidth returns a double containing the width of an element, relative to the layout.

func (*HTMLElement) SetAccessKey

func (e *HTMLElement) SetAccessKey(v string)

SetAccessKey is a DOMString representing the access key assigned to the element.

func (*HTMLElement) SetContentEditable

func (e *HTMLElement) SetContentEditable(v string)

SetContentEditable is a DOMString, where a value of "true" means the element is editable and a value of "false" means it isn't.

func (*HTMLElement) SetDir

func (e *HTMLElement) SetDir(v string)

SetDir is a DOMString, reflecting the dir global attribute, representing the directionality of the element. Possible values are "ltr", "rtl", and "auto".

func (*HTMLElement) SetDraggable

func (e *HTMLElement) SetDraggable(v bool)

SetDraggable is a Boolean indicating if the element can be dragged.

func (*HTMLElement) SetHidden

func (e *HTMLElement) SetHidden(v bool)

SetHidden is a Boolean indicating if the element is hidden or not.

func (*HTMLElement) SetInert

func (e *HTMLElement) SetInert(v bool)

SetInert is a Boolean indicating whether the user agent must act as though the given node is absent for the purposes of user interaction events, in-page text searches ("find in page"), and text selection.

func (*HTMLElement) SetInnerText

func (e *HTMLElement) SetInnerText(v string)

SetInnerText represents the "rendered" text content of a node and its descendants. As a getter, it approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied it to the clipboard.

func (*HTMLElement) SetItemId

func (e *HTMLElement) SetItemId(v string)

SetItemId is a DOMString representing the item ID.

func (*HTMLElement) SetItemScope

func (e *HTMLElement) SetItemScope(v bool)

SetItemScope is a Boolean representing the item scope.

func (*HTMLElement) SetItemValue

func (e *HTMLElement) SetItemValue(v js.Value)

SetItemValue returns a Object representing the item value.

func (*HTMLElement) SetLang

func (e *HTMLElement) SetLang(v string)

SetLang is a DOMString representing the language of an element's attributes, text, and element contents.

func (*HTMLElement) SetNoModule

func (e *HTMLElement) SetNoModule(v bool)

SetNoModule is a Boolean indicating whether an import script can be executed in user agents that support module scripts.

func (*HTMLElement) SetNonce

func (e *HTMLElement) SetNonce(v js.Value)

SetNonce returns the cryptographic number used once that is used by Content Security Policy to determine whether a given fetch will be allowed to proceed.

func (*HTMLElement) SetSpellcheck

func (e *HTMLElement) SetSpellcheck(v bool)

SetSpellcheck is a Boolean that controls spell-checking. It is present on all HTML elements, though it doesn't have an effect on all of them.

func (*HTMLElement) SetStyle

func (e *HTMLElement) SetStyle(v *Style)

SetStyle is a CSSStyleDeclaration, an object representing the declarations of an element's style attributes.

func (*HTMLElement) SetTabIndex

func (e *HTMLElement) SetTabIndex(v int)

SetTabIndex is a long representing the position of the element in the tabbing order.

func (*HTMLElement) SetTitle

func (e *HTMLElement) SetTitle(v string)

SetTitle is a DOMString containing the text that appears in a popup box when mouse is over the element.

func (*HTMLElement) SetTranslate

func (e *HTMLElement) SetTranslate(v bool)

SetTranslate is a Boolean representing the translation.

func (*HTMLElement) Spellcheck

func (e *HTMLElement) Spellcheck() bool

Spellcheck is a Boolean that controls spell-checking. It is present on all HTML elements, though it doesn't have an effect on all of them.

func (*HTMLElement) Style

func (e *HTMLElement) Style() *Style

Style is a CSSStyleDeclaration, an object representing the declarations of an element's style attributes.

func (*HTMLElement) TabIndex

func (e *HTMLElement) TabIndex() int

TabIndex is a long representing the position of the element in the tabbing order.

func (*HTMLElement) Title

func (e *HTMLElement) Title() string

Title is a DOMString containing the text that appears in a popup box when mouse is over the element.

func (*HTMLElement) Translate

func (e *HTMLElement) Translate() bool

Translate is a Boolean representing the translation.

type Input

type Input struct {
	HTMLElement
}

func NewInput

func NewInput(typ string) *Input

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) ButtonAttr

func (e *MouseEvent) ButtonAttr() string

func (*MouseEvent) ClientPos

func (e *MouseEvent) ClientPos() Point

func (*MouseEvent) CtrlKey

func (e *MouseEvent) CtrlKey() bool

func (*MouseEvent) Key

func (e *MouseEvent) Key() string

func (*MouseEvent) KeyCode

func (e *MouseEvent) KeyCode() string

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) AddCustomEventListener

func (e *NodeBase) AddCustomEventListener(typ string, h EventHandler, values js.Value)

func (*NodeBase) AddErrorListener

func (e *NodeBase) AddErrorListener(h func(err error))

func (*NodeBase) AddEventListener

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

func (*NodeBase) AddPassiveEventListener

func (e *NodeBase) AddPassiveEventListener(typ string, 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) Clone

func (e *NodeBase) Clone() Node

func (*NodeBase) Contains

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

func (*NodeBase) InsertAfter

func (e *NodeBase) InsertAfter(a, b Node)

func (*NodeBase) InsertBefore

func (e *NodeBase) InsertBefore(a, b Node)

func (*NodeBase) IsEqualNode

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

func (*NodeBase) IsSameNode

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

func (*NodeBase) JSValue

func (e *NodeBase) JSValue() 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) RemoveCustomEventListener

func (e *NodeBase) RemoveCustomEventListener(typ string, h EventHandler, values js.Value)

func (*NodeBase) RemoveEventListener

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

func (*NodeBase) RemovePassiveEventListener

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

func (*NodeBase) ReplaceChild

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

func (*NodeBase) SetTextContent

func (e *NodeBase) SetTextContent(s string)

func (*NodeBase) SetValue

func (e *NodeBase) SetValue(a interface{})

func (*NodeBase) TextContent

func (e *NodeBase) TextContent() string

func (*NodeBase) Value

func (e *NodeBase) Value() 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 Position

type Position string
const (
	BeforeBegin Position = "beforebegin"
	BeforeEnd   Position = "beforeend"
	AfterBegin  Position = "afterbegin"
	AfterEnd    Position = "afterend"
)

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 ShadowRoot

type ShadowRoot struct {
	NodeBase
}

func AsShadowRoot

func AsShadowRoot(v js.Value) *ShadowRoot

func (*ShadowRoot) Host

func (r *ShadowRoot) Host() *Element

func (*ShadowRoot) InnerHTML

func (r *ShadowRoot) InnerHTML() string

func (*ShadowRoot) IsOpen

func (r *ShadowRoot) IsOpen() bool

func (*ShadowRoot) SetInnerHTML

func (r *ShadowRoot) SetInnerHTML(s string)

type Style

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

func AsStyle

func AsStyle(v js.Value) *Style

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 TokenList

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

func AsTokenList

func AsTokenList(v js.Value) *TokenList

func (*TokenList) Add

func (t *TokenList) Add(class ...interface{})

func (*TokenList) Remove

func (t *TokenList) Remove(class ...interface{})

type Unit

type Unit interface {
	String() string
}

type Value

type Value = js.Wrapper

Value is an alias for js.Wrapper.

Derprecated: use js.Wrapper

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) JSValue

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

func (*Window) OnResize

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

func (*Window) Open

func (w *Window) Open(url, windowName string, windowFeatures map[string]string)

func (*Window) SetLocation

func (w *Window) SetLocation(url string)

Directories

Path Synopsis
extension
chrome/native
Package native provides an API for Native Messaging for Chrome extensions.
Package native provides an API for Native Messaging for Chrome extensions.
Package js provides additional functionality on top of syscall/js package for WASM.
Package js provides additional functionality on top of syscall/js package for WASM.
net
ws
Package ws provides a functionality similar to Go net package on top of WebSockets.
Package ws provides a functionality similar to Go net package on top of WebSockets.

Jump to

Keyboard shortcuts

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