jsutil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: BSD-3-Clause Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Await

func Await(promise js.Value) (res js.Value, err error)

Await equivalent for js await statement.

func Bytes2JS

func Bytes2JS(b []byte) js.Value

Bytes2JS convert from byte slice for Go to Uint8Array for JS.

func Callback0

func Callback0(fn func() interface{}) js.Func

Callback0 make auto-release callback without params.

func Callback1

func Callback1(fn func(res js.Value) interface{}) js.Func

Callback1 make auto-release callback with 1 param.

func CallbackN

func CallbackN(fn func(res []js.Value) interface{}) js.Func

CallbackN make auto-release callback with multiple params.

func Fetch

func Fetch(url string, opt map[string]interface{}) (js.Value, error)

Fetch wrapper fetch function.

func Form2Go

func Form2Go(form js.Value) map[string]interface{}

Form2Go retrieve form values from form element.

func IsArray

func IsArray(item js.Value) bool

IsArray checking value is array type.

func JS2Bytes

func JS2Bytes(dv js.Value) []byte

JS2Bytes convert from TypedArray for JS to byte slice for Go.

func JS2Go

func JS2Go(obj js.Value) interface{}

JS2Go JS values convert to Go values.

func RequestAnimationFrame

func RequestAnimationFrame(ch <-chan bool, callback func(dt float64))

RequestAnimationFrame function call for 30 or 60 fps. return value: tick chan

Types

type Releaser

type Releaser interface {
	Release()
}

Releaser ...

func Bind

func Bind(node js.Value, name string, callback func(res js.Value)) Releaser

Bind event bind and return releaser.

func ReleaserFunc

func ReleaserFunc(fn func()) Releaser

ReleaserFunc ...

Jump to

Keyboard shortcuts

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