Documentation
¶
Index ¶
- Variables
- func Append(child js.Value)
- func AppendChild(child js.Value)
- func CreateButton(str string, onclick func()) (button js.Value)
- func CreateElement(tag string) js.Value
- func CreateElementNS(ns, tag string) js.Value
- func CreateLoadFileButton(text, accept string, multiple bool, onchange func(loadFiles js.Value)) (span js.Value)
- func CreateSaveFileButton(text string, options map[string]any, saveFileCallback func(saveFile js.Value)) (button js.Value)
- func FNV1a32(data []byte) js.Value
- func FNV1a64(data []byte) js.Value
- func FuncOf(fn func(args []js.Value) any) js.Func
- func GetElementById(id string) js.Value
- func HasOwn(object js.Value, str string) bool
- func IsError(err js.Value) bool
- func LoadJS(src string, onload func()) (classic js.Value)
- func LoadWASM(str string, then func(), methods ...func(err js.Value))
- func Permissions(str string, permissionsCallback func(permissionStatus js.Value))
- func Prepend(child js.Value)
- func ProcOf(fn func(args []js.Value)) js.Func
- func SHA256(data []byte, shaCallback func(hash js.Value))
- func SHA384(data []byte, shaCallback func(hash js.Value))
- func SHA512(data []byte, shaCallback func(hash js.Value))
- func SetFunc(str string, fn func(args []js.Value) any) js.Func
- func SetProc(str string, fn func(args []js.Value)) js.Func
- func SetSimpleFunc(str string, fn func() any) js.Func
- func SetSimpleProc(str string, fn func()) js.Func
- func SimpleFuncOf(fn func() any) js.Func
- func SimpleProcOf(fn func()) js.Func
- func ThenableChain(thenable js.Value, thenFunc func(arg js.Value) any, ...) any
Constants ¶
This section is empty.
Variables ¶
var ( // Global aliases Global = js.Global() Set = Global.Set Get = Global.Get Call = Global.Call // Global property aliases DevicePixelRatio = Get("devicePixelRatio") InnerHeight = Get("innerHeight") InnerWidth = Get("innerWidth") OuterHeight = Get("outerHeight") OuterWidth = Get("outerWidth") // Constructor aliases Array = Get("Array") AudioContext = Get("AudioContext") Blob = Get("Blob") Date = Get("Date") Error = Get("Error") FileReader = Get("FileReader") Number = Get("Number") Object = Get("Object") Response = Get("Response") String = Get("String") TextDecoder = Get("TextDecoder") TextEncoder = Get("TextEncoder") Uint8Array = Get("Uint8Array") URL = Get("URL") URLSearchParams = Get("URLSearchParams") // BOM namespace object aliases Crypto = Get("crypto") History = Get("history") IndexedDB = Get("indexedDB") Intl = Get("Intl") IDBKeyRange = Get("IDBKeyRange") Location = Get("location") Math = Get("Math") Performance = Get("performance") Screen = Get("screen") Subtle = Crypto.Get("subtle") WebAssembly = Get("WebAssembly") // DOM aliases Document = Get("document") Head = Document.Get("head") Body = Document.Get("body") // Method aliases Alert = Get("alert").Invoke Atob = Get("atob").Invoke Btoa = Get("btoa").Invoke ClearInterval = Get("clearInterval").Invoke ClearTimeout = Get("clearTimeout").Invoke Fetch = Get("fetch").Invoke GetRandomValues = Crypto.Get("getRandomValues").Invoke Log = Get("console").Get("log").Invoke MatchMedia = Get("matchMedia").Invoke ParseInt = Get("parseInt").Invoke SetInterval = Get("setInterval").Invoke SetTimeout = Get("setTimeout").Invoke ShowSaveFilePicker = Get("showSaveFilePicker").Invoke // Convenience variables Params = URLSearchParams.New(Location.Get("search").String()) )
Functions ¶
func AppendChild ¶
func CreateButton ¶
Create a button element with an onclick callback
func CreateElement ¶
func CreateElementNS ¶
func CreateLoadFileButton ¶
func CreateLoadFileButton(text, accept string, multiple bool, onchange func(loadFiles js.Value)) (span js.Value)
Create a span element containing both a hidden input element of type file with an onchange callback and also a button to trigger it
func CreateSaveFileButton ¶
func CreateSaveFileButton(text string, options map[string]any, saveFileCallback func(saveFile js.Value)) (button js.Value)
Create a button which calls showSaveFilePicker with a callback
func FNV1a32 ¶
32-bit variation of the FNV-1a non-cryptographic hashing algorithm which immediately/synchonously returns the hash as a JS ArrayBuffer
func FNV1a64 ¶
64-bit variation of the FNV-1a non-cryptographic hashing algorithm which immediately/synchonously returns the hash as a JS ArrayBuffer
func GetElementById ¶
func Permissions ¶
Takes a permission descriptor, such as "camera", "microphone", "geolocation", etc., and a callback to handle the returned PermissionStatus object
func SHA256 ¶
256-bit variation of SHA-2 which takes the data byte slice and callback to asynchonrously handle the hash as a JS ArrayBuffer
func SHA384 ¶
384-bit variation of SHA-2 which takes the data byte slice and callback to asynchonrously handle the hash as a JS ArrayBuffer
func SHA512 ¶
512-bit variation of SHA-2 which takes the data byte slice and callback to asynchonrously handle the hash as a JS ArrayBuffer
func SetSimpleFunc ¶
Expose a Go function which has no arguments to JS globally
func SetSimpleProc ¶
Expose a Go procedure which has no arguments to JS globally
func SimpleFuncOf ¶
Wrap a Go function which has no arguments so it can be used by JS
func SimpleProcOf ¶
Wrap a Go procedure which has no arguments so it can be used by JS
Types ¶
This section is empty.