jsutil

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 1 Imported by: 0

README

Bhojpur Web - Javascript Utility

A WebAssembly -to- JavaScript interoperability extension for Bhojpur Web. This library works only in wasm mode.

Installation

go get github.com/bhojpur/web@latest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Await

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

Await equivalent for js await statement.

func Bytes2JS

func Bytes2JS(b []byte) app.Value

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

func Callback0

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

Callback0 make auto-release callback without params.

func Callback1

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

Callback1 make auto-release callback with 1 param.

func CallbackN

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

CallbackN make auto-release callback with multiple params.

func Fetch

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

Fetch wrapper fetch function.

func Form2Go

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

Form2Go retrieve form values from form element.

func IsArray

func IsArray(item app.Value) bool

IsArray checking value is array type.

func JS2Bytes

func JS2Bytes(v app.Value) []byte

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

func JS2Go

func JS2Go(obj app.Value) interface{}

JS2Go JS values convert to Go values.

func UnwrapError

func UnwrapError(v app.Value) error

UnwrapError to unwrap app.Value to golang standard error.

func WrapError

func WrapError(err error) app.Value

WrapError to wrap golang standard error to app.Value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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