Documentation ¶
Overview ¶
This package provides wrappers to make it easier to work with web APIs. The core is in js.go, which makes it easy to embed javascript in your Go code.
Index ¶
- func Alert(msg string)
- func Body() js.Value
- func CreateElement(tag string) js.Value
- func CreateInputElement(accept []string, ch chan<- []byte) js.Value
- func CreateParamInput(ctx context.Context, label string, backing interface{}, shortDesc string, ...) js.Value
- func CreateSVGElement(tag string) js.Value
- func Document() js.Value
- func Global(key string) js.Value
- func JsExec(code string, args ...interface{}) js.Value
- func MakeDownloadLink(data []byte, filename string, mime string) js.Value
- func MakeFunction(code string, nocache ...bool) js.Value
- type Page
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateElement ¶
func CreateInputElement ¶
Create an input element for single file upload which will push a slice of bytes into the provided channel.
func CreateParamInput ¶
func CreateParamInput( ctx context.Context, label string, backing interface{}, shortDesc string, longDesc string, changeCh chan struct{}, attrs map[string]string, ) js.Value
Create labeled form elements with short and long descriptions
backing must be a pointer to a value that will be set by the form
func CreateSVGElement ¶
func MakeFunction ¶
Create a function from a javascript string. The function will be cached unless you pass `true` for nocache. Caching allows the browser to optimize frequently called functions, but every cached function stays in memory forever, so it is not appropriate for iifes.
Types ¶
type Page ¶
func (*Page) Init ¶
func (p *Page) Init()
Re-init the page's element. If you do this while the element is on the page, its behavior is undefined.