dom

package
v0.0.0-...-c857007 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package dom contains the javascript bindings for the site

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneElement

func CloneElement(query string) js.Value

CloneElement creates a close of the element, which should be a template.

func Confirm

func Confirm(message string) bool

Confirm shows a popup asking the user a yes/no question. The true return value implies the "yes" choice.

func FormatTime

func FormatTime(utcSeconds int64) string

FormatTime formats a datetime to HH:MM:SS.

func GetCheckedQuery

func GetCheckedQuery(query string) bool

GetCheckedQuery returns whether the element has a checked value of true.

func GetValue

func GetValue(query string) string

GetValue gets the value of the input element.

func NewJsEventFunc

func NewJsEventFunc(fn func(event js.Value)) js.Func

NewJsEventFunc creates a new javascript function from the provided function that processes an event and returns nothing. PreventDefault is called on the event before applying the function

func NewJsFunc

func NewJsFunc(fn func()) js.Func

NewJsFunc creates a new javascript function from the provided function.

func NewWebSocket

func NewWebSocket(url string) js.Value

NewWebSocket creates a new WebSocket with the specified url.

func QuerySelector

func QuerySelector(query string) js.Value

QuerySelector returns the first element returned by the query from root of the document.

func QuerySelectorAll

func QuerySelectorAll(document js.Value, query string) []js.Value

QuerySelectorAll returns an array of the elements returned by the query from the specified document.

func RegisterFunc

func RegisterFunc(parentName, fnName string, fn js.Func)

RegisterFunc sets the function as a field on the parent. The parent object is created if it does not exist.

func SetButtonDisabled

func SetButtonDisabled(query string, disabled bool)

SetButtonDisabled sets the disable property of the button element.

func SetCheckedQuery

func SetCheckedQuery(query string, checked bool)

SetCheckedQuery sets the checked property of the element.

func SetValue

func SetValue(query, value string)

SetValue sets the value of the input element.

Types

type Form

type Form struct {
	Method string
	URL    url.URL
	Params url.Values
	// contains filtered or unexported fields
}

Form contains the fields needed to make a request to the server.

func NewForm

func NewForm(event js.Value) (*Form, error)

func (*Form) Reset

func (f *Form) Reset()

Reset clears the named inputs of the form.

func (*Form) StoreCredentials

func (f *Form) StoreCredentials()

StoreCredentials attempts to save the credentials for the login, if browser wants to

Jump to

Keyboard shortcuts

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