wasm

package module
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Await

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

Await synchronizes the input promise.

func Call

func Call(obj js.Value, method string, args ...any) (js.Value, error)

Call is the method variant of Invoke.

func Copy added in v0.2.5

func Copy(dst Bytes, src Bytes)

func Invoke

func Invoke(fn js.Value, args ...any) (js.Value, error)

Invoke exectues a function call, catching a thrown exception and returning it as a Go error.

func Keys

func Keys(obj js.Value) []string

Keys returns the keys of a JS object.

func New added in v0.2.12

func New(class js.Value, args ...any) (js.Value, error)

func Print

func Print(v js.Value)

Print uses the console.log function to print JS values.

Types

type Bytes

type Bytes struct {
	// contains filtered or unexported fields
}

Bytes mimics []byte using a JS Uint8Array as the underlying array.

func BytesMake added in v0.2.9

func BytesMake(length, capacity int) Bytes

func BytesOf added in v0.2.5

func BytesOf(b []byte) Bytes

func View

func View(arrayBuffer js.Value) Bytes

func (Bytes) Append added in v0.2.5

func (x Bytes) Append(b []byte) Bytes

func (Bytes) Cap added in v0.2.5

func (x Bytes) Cap() int

func (Bytes) CopyFrom

func (x Bytes) CopyFrom(b []byte) int

func (Bytes) CopyTo

func (x Bytes) CopyTo(b []byte) int

func (Bytes) Js

func (x Bytes) Js() js.Value

func (Bytes) Len added in v0.2.5

func (x Bytes) Len() int

func (Bytes) Slice

func (x Bytes) Slice(start, end int) Bytes

type BytesReader added in v0.2.5

type BytesReader struct {
	Src Bytes
}

BytesReader wraps a Bytes object to function as an io.Reader. [Src] must be a valid Bytes value. It can be retrieved or exchanged when done, and will always be the remaining subslice of the initial data.

func (*BytesReader) Close added in v0.2.5

func (x *BytesReader) Close() error

func (*BytesReader) Read added in v0.2.5

func (x *BytesReader) Read(b []byte) (int, error)

type BytesWriter added in v0.2.5

type BytesWriter struct {
	Dst Bytes
}

BytesWriter wraps a Bytes object to function as an io.Writer. [Dst] must be a valid Bytes value. It may be freely retrieved or exchanged when done writing to the current value.

func (*BytesWriter) Close added in v0.2.5

func (x *BytesWriter) Close() error

func (*BytesWriter) Write added in v0.2.5

func (x *BytesWriter) Write(b []byte) (int, error)

type Ticker added in v0.2.4

type Ticker struct {
	// contains filtered or unexported fields
}

A Ticker represents a JS Interval. Useful to synchronize with the main JS thread.

func TickerMake added in v0.2.9

func TickerMake(ms uint64, fn func()) Ticker

func (Ticker) Stop added in v0.2.4

func (x Ticker) Stop()

Stop disables the Ticker. Must be called from event loop.

type Timer added in v0.2.4

type Timer struct {
	// contains filtered or unexported fields
}

A Timer represents a JS Timeout. Useful to synchronize with the main JS thread.

func TimerMake added in v0.2.9

func TimerMake(ms uint64, fn func()) Timer

func (Timer) Stop added in v0.2.4

func (x Timer) Stop()

Stop prevents the Timer from firing, if it has not already done so. Must be called from event loop.

Directories

Path Synopsis
Package css provides CSS Go definitions.
Package css provides CSS Go definitions.
dom
Package dom wraps JS DOM functionality.
Package dom wraps JS DOM functionality.
elements
Package elements provides definitions for common DOM elements.
Package elements provides definitions for common DOM elements.
Package media wraps the JS MediaDevices API.
Package media wraps the JS MediaDevices API.
webm
Package webm implements the WebM media type.
Package webm implements the WebM media type.
Package svg wraps SVG DOM elements.
Package svg wraps SVG DOM elements.

Jump to

Keyboard shortcuts

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