codec

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HtmlElements = map[string]string{}/* 141 elements not displayed */

Functions

func DecodeBoolean

func DecodeBoolean[T any](_ js.CallbackContext[T], val js.Value[T]) (bool, error)

func DecodeFunction

func DecodeFunction[T any](cbCtx js.CallbackContext[T], val js.Value[T]) (js.Function[T], error)

func DecodeHTMLElement

func DecodeHTMLElement[T any](
	ctx js.CallbackContext[T],
	val js.Value[T],
) (html.HTMLElement, error)

func DecodeInt

func DecodeInt[T any](_ js.CallbackContext[T], val js.Value[T]) (int, error)

func DecodeNode

func DecodeNode[T any](ctx js.CallbackContext[T], val js.Value[T]) (dom.Node, error)

func DecodeString

func DecodeString[T any](cbCtx js.CallbackContext[T], val js.Value[T]) (string, error)

func EncodeBoolean

func EncodeBoolean[T any](cbCtx js.CallbackScope[T], b bool) (js.Value[T], error)

func EncodeConstrucedValue

func EncodeConstrucedValue[T any](cbCtx js.CallbackScope[T], val any) (js.Value[T], error)

EncodeConstrucedValue is a simple helper for JS constructor callbacks to store the constructed Go value in the JavaScript object, and possibly cache it with the script context.

func EncodeEntity

func EncodeEntity[T any](cbCtx js.CallbackScope[T], e entity.ObjectIder) (js.Value[T], error)

getJSInstance gets the JavaScript object that wraps a specific Go object. If a wrapper already has been created, that wrapper is returned; otherwise a new object is created with the correct prototype configured.

func EncodeEntityScoped

func EncodeEntityScoped[T any](scope js.Scope[T], e entity.ObjectIder) (js.Value[T], error)

TODO: Embed scope in CallbackScope, so only one function is necessary

func EncodeInt

func EncodeInt[T any](cbCtx js.CallbackScope[T], i int) (js.Value[T], error)

func EncodeNillableString

func EncodeNillableString[T any](
	cbCtx js.CallbackScope[T],
	s string,
	hasValue bool,
) (js.Value[T], error)

func EncodeNull

func EncodeNull[T any](cbCtx js.CallbackScope[T]) (js.Value[T], error)

func EncodeNullableString

func EncodeNullableString[T any](
	cbCtx js.CallbackScope[T],
	s *string,
) (js.Value[T], error)

func EncodeString

func EncodeString[T any](cbCtx js.CallbackScope[T], s string) (js.Value[T], error)

func EncodeStringScoped

func EncodeStringScoped[T any](cbCtx js.Scope[T], s string) (js.Value[T], error)

TODO: Embed scope in CallbackScope, so only one function is necessary

func LookupJSPrototype

func LookupJSPrototype(entity entity.ObjectIder) string

func ZeroValue

func ZeroValue[T any]() (res T)

Types

type EventInit

type EventInit struct {
	Bubbles    bool
	Cancelable bool
	Init       any
}

func DecodeEventInit

func DecodeEventInit[T any](
	_ js.CallbackContext[T],
	val js.Value[T],
) (EventInit, error)

Jump to

Keyboard shortcuts

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