Documentation ¶
Overview ¶
Package dom contains the javascript bindings for the site
Index ¶
- func AlertOnPanic()
- func Base64Decode(a string) []byte
- func Checked(query string) bool
- func CloneElement(query string) js.Value
- func Color(element js.Value) string
- func Confirm(message string) bool
- func FormatTime(utcSeconds int64) string
- func NewJsEventFunc(fn func(event js.Value)) js.Func
- func NewJsEventFuncAsync(fn func(event js.Value), async bool) js.Func
- func NewJsFunc(fn func()) js.Func
- func NewWebSocket(url string) js.Value
- func NewXHR() js.Value
- func QuerySelector(query string) js.Value
- func QuerySelectorAll(document js.Value, query string) []js.Value
- func RecoverError(r interface{}) error
- func RegisterFuncs(ctx context.Context, wg *sync.WaitGroup, parentName string, ...)
- func ReleaseJsFuncsOnDone(ctx context.Context, wg *sync.WaitGroup, jsFuncs map[string]js.Func)
- func SetButtonDisabled(query string, disabled bool)
- func SetChecked(query string, checked bool)
- func SetValue(query, value string)
- func Value(query string) string
- type Form
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlertOnPanic ¶
func AlertOnPanic()
AlertOnPanic checks to see if a panic has occurred. This function should be deferred as the first statement for each goroutine.
func Base64Decode ¶ added in v1.1.0
Base64Decode decodes the ascii base-64 string to binary (atob). Panics if the encodedData is not a valid url encoded base64 string.
func CloneElement ¶
CloneElement creates a close of the element, which should be a template.
func Confirm ¶
Confirm shows a popup asking the user a yes/no question. The true return value implies the "yes" choice.
func FormatTime ¶
FormatTime formats a datetime to HH:MM:SS.
func NewJsEventFunc ¶
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 NewJsEventFuncAsync ¶
NewJsEventFuncAsync performs similarly to NewJsEventFunc, but calls the event-handling function asynchronously if async is true.
func NewWebSocket ¶
NewWebSocket creates a new WebSocket with the specified url.
func QuerySelector ¶
QuerySelector returns the first element returned by the query from root of the document.
func QuerySelectorAll ¶
QuerySelectorAll returns an array of the elements returned by the query from the specified document.
func RecoverError ¶
func RecoverError(r interface{}) error
RecoverError converts the recovery interface into a useful error. Panics if the interface is not an error or a string.
func RegisterFuncs ¶
func RegisterFuncs(ctx context.Context, wg *sync.WaitGroup, parentName string, jsFuncs map[string]js.Func)
RegisterFuncs sets the function as fields on the parent. The parent object is created if it does not exist.
func ReleaseJsFuncsOnDone ¶
ReleaseJsFuncsOnDone releases the jsFuncs and decrements the waitgroup when the context is done. This function should be called on a separate goroutine.
func SetButtonDisabled ¶
SetButtonDisabled sets the disable property of the button element.
func SetChecked ¶
SetChecked sets the checked property of the 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 ¶
NewForm creates a form from the target property of the event. An error is returned if the url action is not successfully parsed.
func (*Form) StoreCredentials ¶
func (f *Form) StoreCredentials()
StoreCredentials attempts to save the credentials for the login, if browser wants to.