Documentation ¶
Index ¶
- func RegisterFunc(name string, fn CallbackFunc)
- type CallbackFunc
- type Element
- func (e *Element) AddEventListener(event string, listener CallbackFunc)
- func (e *Element) Append(e2 *Element) *Element
- func (e *Element) Clone() *Element
- func (e *Element) GetElementByTagName(tag string) *Element
- func (e *Element) GetElementsByTagName(tag string) []*Element
- func (e *Element) GetInnerHTML() *Element
- func (e *Element) ParentElement() *Element
- func (e *Element) RemoveAllEventListeners() *Element
- func (e *Element) ReplaceChild(newChild *Element, oldChild *Element)
- func (e *Element) WithID(id string) *Element
- func (e *Element) WithInnerHTML(content interface{}) *Element
- type Location
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterFunc ¶
func RegisterFunc(name string, fn CallbackFunc)
RegisterFunc registers a java script function
Types ¶
type CallbackFunc ¶
CallbackFunc defines the signature of a callback
type Element ¶
Element represents a dom element
func CreateElement ¶
CreateElement calls into the dom to create a new element
func GetElementByID ¶
GetElementByID calls into the dom to getElementById https://www.w3schools.com/jsref/met_document_getelementbyid.asp
func (*Element) AddEventListener ¶
func (e *Element) AddEventListener(event string, listener CallbackFunc)
AddEventListener attaches an event listener to the current element
func (*Element) GetElementByTagName ¶
GetElementByTagName returns the first element with a matching tag name under the current element
func (*Element) GetElementsByTagName ¶
GetElementsByTagName returns a slice of elements with the given tag name
func (*Element) GetInnerHTML ¶
GetInnerHTML returns the inner html data
func (*Element) ParentElement ¶
ParentElement returns the parent element of the current element
func (*Element) RemoveAllEventListeners ¶
RemoveAllEventListeners removes all event listeners from the current element
func (*Element) ReplaceChild ¶
ReplaceChild replaces a child node based on the child node
func (*Element) WithInnerHTML ¶
WithInnerHTML overwrites any text or sub nodes of this element
type Location ¶
type Location struct { Href string Host string Hostname string Protocol string Pathname string Search string Hash string }
Location represents the javascript location object https://www.w3docs.com/snippets/javascript/how-to-get-current-url-in-javascript.html
func ParseLocation ¶
ParseLocation parses the javascript location object into a Location struct instance