ui

package
v0.0.0-...-5b5682b Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package ui contains functions to make the website interactive that can be compiled to WebAssembly for the website.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlertOnPanic

func AlertOnPanic()

AlertOnPanic checks to see if a panic has occurred. Thes function shoould be deferred as the first statement for each goroutine

func CloneElement

func CloneElement(query string) js.Value

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

func FormatTime

func FormatTime(utcSeconds int64) string

FormatTime formats a datetime to HH:MM:SS.

func InitDomFuncs

func InitDomFuncs(ctx context.Context, wg *sync.WaitGroup)

InitDomFuncs registers the logging and otp javascript functions.

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

func ReleaseJsFuncsOnDone(ctx context.Context, wg *sync.WaitGroup, jsFuncs map[string]js.Func)

ReleaseJsFuncsOnDone releases the jsFuncs and decrements the waitgroup when the context is done. This function should be called on a separate goroutine.

func SetButtonDisabled

func SetButtonDisabled(query string, disabled bool)

SetButtonDisabled sets the disable property of the button element.

func SetChecked

func SetChecked(query string, checked bool)

SetChecked sets the checked property of the element.

func SetValue

func SetValue(query, value string)

SetValue sets the value of the input element.

func Value

func Value(query string) string

Value gets the value of the input element.

Types

This section is empty.

Jump to

Keyboard shortcuts

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