js

package
v2.0.0-...-30997d8 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

View Source
const (
	TypeUndefined = jst.TypeUndefined
	TypeNull      = jst.TypeNull
	TypeBoolean   = jst.TypeBoolean
	TypeNumber    = jst.TypeNumber
	TypeString    = jst.TypeString
	TypeSymbol    = jst.TypeSymbol
	TypeObject    = jst.TypeObject
	TypeFunction  = jst.TypeFunction
)

Re-exported Value type constants.

Variables

This section is empty.

Functions

func Expose

func Expose(name string, fn func())

Expose registers a no-argument Go function under the given name on the JavaScript global object.

func ExposeEvent

func ExposeEvent(name string, fn func(Value))

ExposeEvent registers a Go function that receives the first argument from the JavaScript call as the event object.

func ExposeFunc

func ExposeFunc(name string, fn func(this Value, args []Value) any)

ExposeFunc registers a Go function with custom arguments on the JavaScript global object.

func RAF

func RAF(cb Func)

RAF is an alias for RequestAnimationFrame.

func RequestAnimationFrame

func RequestAnimationFrame(cb Func)

RequestAnimationFrame wraps the requestAnimationFrame global function.

func Set

func Set(name string, v any)

Set assigns a value on the global object.

func Stack

func Stack() string

Stack returns the current JavaScript stack trace using Error().stack.

func TypedArrayOf

func TypedArrayOf(slice any) jst.Value

TypedArrayOf converts a Go slice to a JavaScript typed array.

Types

type Array

type Array struct{ Value }

Array represents a JavaScript Array instance.

func ArrayOf

func ArrayOf(v Value) Array

ArrayOf wraps an existing JavaScript value as an Array.

func NewArray

func NewArray(items ...any) Array

NewArray constructs a new JavaScript Array.

func (Array) Concat

func (a Array) Concat(arrs ...Array) Array

Concat merges the array with additional arrays.

func (Array) Length

func (a Array) Length() int

Length reports the number of elements in the array.

func (Array) Push

func (a Array) Push(items ...any) int

Push appends items to the array and returns the new length.

type Dict

type Dict struct{ Value }

Dict represents a plain JavaScript object with string keys.

func DictOf

func DictOf(v Value) Dict

DictOf wraps an existing JavaScript value as a Dict.

func NewDict

func NewDict() Dict

NewDict constructs a new empty JavaScript object.

func (Dict) Get

func (d Dict) Get(key string) Value

Get retrieves a property from the object.

func (Dict) Keys

func (d Dict) Keys() []string

Keys returns all enumerable property names on the object.

func (Dict) Set

func (d Dict) Set(key string, val any)

Set assigns a property on the object.

type Func

type Func = jst.Func

Type aliases to re-export syscall/js types.

func FuncOf

func FuncOf(fn func(this Value, args []Value) any) Func

FuncOf wraps a Go function for use in JavaScript.

type Type

type Type = jst.Type

Type aliases to re-export syscall/js types.

type Value

type Value = jst.Value

Type aliases to re-export syscall/js types.

func Call

func Call(name string, args ...any) Value

Call invokes a function on the global object.

func Console

func Console() Value

Console returns the console object.

func CustomEvent

func CustomEvent() Value

CustomEvent returns the CustomEvent constructor.

func Doc

func Doc() Value

Doc is an alias for Document.

func Document

func Document() Value

Document returns the document object.

func Error

func Error() Value

Error returns the Error constructor.

func Fetch

func Fetch(args ...any) Value

Fetch wraps the global fetch function.

func Float32Array

func Float32Array() Value

Float32Array returns the Float32Array constructor.

func Get

func Get(name string) Value

Get returns a property from the global object.

func Global

func Global() Value

Global returns the JavaScript global object.

func History

func History() Value

History returns the history object.

func Image

func Image() Value

Image returns the Image constructor.

func IntersectionObserver

func IntersectionObserver() Value

IntersectionObserver returns the IntersectionObserver constructor.

func JSON

func JSON() Value

JSON returns the JSON object.

func LS

func LS() Value

LS is an alias for LocalStorage.

func Loc

func Loc() Value

Loc is an alias for Location.

func LocalStorage

func LocalStorage() Value

LocalStorage returns the localStorage object.

func Location

func Location() Value

Location returns the location object.

func Math

func Math() Value

Math returns the Math object.

func MutationObserver

func MutationObserver() Value

MutationObserver returns the MutationObserver constructor.

func Null

func Null() Value

Null returns the JavaScript null value.

func Object

func Object() Value

Object returns the JavaScript Object constructor.

func Perf

func Perf() Value

Perf is an alias for Performance.

func Performance

func Performance() Value

Performance returns the performance object.

func RegExp

func RegExp() Value

RegExp returns the RegExp constructor.

func Uint8Array

func Uint8Array() Value

Uint8Array returns the Uint8Array constructor.

func Uint16Array

func Uint16Array() Value

Uint16Array returns the Uint16Array constructor.

func Undefined

func Undefined() Value

Undefined returns the JavaScript undefined value.

func ValueOf

func ValueOf(v any) Value

ValueOf converts a Go value to a JavaScript value.

func WebAssembly

func WebAssembly() Value

WebAssembly returns the WebAssembly object.

func Win

func Win() Value

Win is an alias for Window.

func Window

func Window() Value

Window returns the window object.

Directories

Path Synopsis
shim

Jump to

Keyboard shortcuts

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