Versions in this module Expand all Collapse all v0 v0.0.8 Jun 1, 2026 v0.0.7 Jun 1, 2026 Changes in this version + const JsEvalFlagAsync + const JsEvalFlagBackTraceBarrier + const JsEvalFlagCompileOnly + const JsEvalFlagStrict + const JsEvalFlagUnUsed + const JsEvalTypeDirect + const JsEvalTypeGlobal + const JsEvalTypeInDirect + const JsEvalTypeMask + const JsEvalTypeModule + const MinMapForeachArgs + const NanosToMillis + const NullPtr + const PackedPtrSize + const StringTerminator + const Uint64ByteSize + const Uint64SignBitPosition + var ErrAsyncFuncRequirePromise = errors.New("jsFunctionProxy: async function requires a promise") + var ErrCallFuncOnNonObject = errors.New("cannot call function on non-object") + var ErrChanCloseReceiveOnly = errors.New("cannot close receive-only channel") + var ErrChanClosed = errors.New("channel is closed") + var ErrChanReceive = errors.New("channel receive would block: buffer empty or no sender ready") + var ErrChanSend = errors.New("channel send would block: buffer full or no receiver ready") + var ErrEmptyStringToNumber = errors.New("empty string cannot be converted to number") + var ErrIndexOutOfRange = errors.New("index out of range") + var ErrInvalidContext = errors.New("invalid context") + var ErrInvalidFileName = errors.New("file name is required") + var ErrInvalidPointer = errors.New("null pointer dereference") + var ErrJsFuncDeallocated = errors.New("js function context has been deallocated") + var ErrMissingBufferProperty = errors.New("invalid TypedArray: missing buffer property") + var ErrMissingProperties = errors.New("value has no properties") + var ErrNilHandle = errors.New("handle is nil") + var ErrNilModule = errors.New("WASM module is nil") + var ErrNoNullTerminator = errors.New("no NUL terminator") + var ErrNotANumber = errors.New("js value is not a number") + var ErrNotAnObject = errors.New("value is not an object") + var ErrNotArrayBuffer = errors.New("input is not an ArrayBuffer") + var ErrNotByteArray = errors.New("invalid TypedArray: buffer is not a byte array") + var ErrObjectNotAConstructor = errors.New("object not a constructor") + var ErrRType = reflect.TypeOf((*error)(nil)).Elem() + var ErrRuntimeClosed = errors.New("runtime is closed") + var ErrZeroRValue = reflect.Zero(ErrRType) + func AnyToError(err any) error + func ConvertToSigned[T Signed](h *Handle) T + func ConvertToUnsigned[T Unsigned](h *Handle) T + func CreateChannelCloseFunc(rval reflect.Value) func() error + func CreateChannelReceiveFunc(chanRValue reflect.Value) func() (any, error) + func CreateChannelSendFunc(chanRValue reflect.Value) any + func CreateGoBindFuncType[T any](sample T) (fnType reflect.Type, err error) + func CreateGoFuncSignature(fnType reflect.Type) string + func CreateNonNilSample(argType reflect.Type) any + func CreateVariadicSlice(jsArgs []*Value, sliceType reflect.Type, fixedArgsCount int) (reflect.Value, error) + func FloatToInt(floatVal float64, targetKind reflect.Kind) (any, error) + func GetGoTypeName(input any) string + func Is32BitPlatform() bool + func IsConvertibleToJs(rType reflect.Type, visited map[reflect.Type]bool, detail string) (err error) + func IsImplementError(rtype reflect.Type) bool + func IsImplementsJSONUnmarshaler(t reflect.Type) bool + func IsNumericType(t reflect.Type) bool + func IsTypedArray(input *Value) bool + func IsValid32BitFloat(floatVal float64, targetKind reflect.Kind) error + func JsArgToGo(jsArg *Value, argType reflect.Type) (reflect.Value, error) + func JsArrayBufferToGo(input *Value) ([]byte, error) + func JsArrayToGo[T any](input *Value, samples ...T) (T, error) + func JsBigIntToGo[T any](input *Value, samples ...T) (v T, err error) + func JsFuncArgsToGo(jsArgs []*Value, fnType reflect.Type) ([]reflect.Value, error) + func JsFuncToGo[T any](input *Value, samples ...T) (v T, err error) + func JsNumberToGo[T any](input *Value, samples ...T) (v T, err error) + func JsObjectOrMapToGoMap[T any](input *Value, samples ...T) (v T, err error) + func JsObjectOrMapToGoStruct[T any](input *Value, samples ...T) (v T, err error) + func JsObjectToGo[T any](input *Value, samples ...T) (v T, err error) + func JsSetToGo[T any](input *Value, samples ...T) (v T, err error) + func JsTimeToGo(input *Value) (time.Time, error) + func JsTypedArrayToGo(input *Value) ([]byte, error) + func Min(a, b int) int + func NumericBoundsCheck(floatVal float64, targetKind reflect.Kind) error + func ParseTimezone(tz string) *time.Location + func StringToNumeric(s string, targetType reflect.Type) (result any, err error) + func ToGoValue[T any](input *Value, samples ...T) (v T, err error) + func VerifyGoFunc(fnType reflect.Type, sample any) error + type Array struct + func NewArray(value *Value) *Array + func (a *Array) Delete(index int64) bool + func (a *Array) ForEach(forFn func(key, value *Value)) + func (a *Array) Get(index int64) *Value + func (a *Array) HasIndex(i int64) bool + func (a *Array) Push(elements ...*Value) int64 + func (a *Array) Set(index int64, value *Value) + type AsyncFunction func(ctx *This) + type Atom struct + func (a Atom) Free() + func (a Atom) String() string + func (a Atom) ToValue() *Value + type CircularTracker struct + type Context struct + func (c *Context) Call(name string, args ...uint64) *Value + func (c *Context) CallUnPack(name string, args ...uint64) (uint32, uint32) + func (c *Context) Compile(file string, flags ...EvalOptionFunc) ([]byte, error) + func (c *Context) Eval(file string, flags ...EvalOptionFunc) (*Value, error) + func (c *Context) Exception() error + func (c *Context) FreeHandle(ptr uint64) + func (c *Context) FreeJsValue(val uint64) + func (c *Context) Function(fn Function, isAsyncs ...bool) *Value + func (c *Context) Global() *Value + func (c *Context) HasException() bool + func (c *Context) Invoke(fn *Value, this *Value, args ...*Value) (*Value, error) + func (c *Context) Load(file string, flags ...EvalOptionFunc) (*Value, error) + func (c *Context) Malloc(size uint64) uint64 + func (c *Context) MemRead(addr uint32, size uint64) []byte + func (c *Context) MemWrite(addr uint32, b []byte) + func (c *Context) NewArray() *Array + func (c *Context) NewArrayBuffer(binaryData []byte) *Value + func (c *Context) NewAtom(v string) Atom + func (c *Context) NewAtomIndex(index int64) Atom + func (c *Context) NewBigInt64(v int64) *Value + func (c *Context) NewBigUint64(v uint64) *Value + func (c *Context) NewBool(b bool) *Value + func (c *Context) NewBytes(v []byte) *Value + func (c *Context) NewDate(t *time.Time) *Value + func (c *Context) NewError(e error) *Value + func (c *Context) NewFloat64(v float64) *Value + func (c *Context) NewInt32(v int32) *Value + func (c *Context) NewInt64(v int64) *Value + func (c *Context) NewMap() *Map + func (c *Context) NewNull() *Value + func (c *Context) NewObject() *Value + func (c *Context) NewProxyValue(v any) *Value + func (c *Context) NewSet() *Set + func (c *Context) NewString(v string) *Value + func (c *Context) NewStringHandle(v string) *Value + func (c *Context) NewUint32(v uint32) *Value + func (c *Context) NewUndefined() *Value + func (c *Context) NewUninitialized() *Value + func (c *Context) NewValue(handle *Handle) *Value + func (c *Context) ParseJSON(v string) *Value + func (c *Context) Raw() uint64 + func (c *Context) SetAsyncFunc(name string, fn AsyncFunction) + func (c *Context) SetFunc(name string, fn Function) + func (c *Context) String() string + func (c *Context) Throw(v *Value) *Value + func (c *Context) ThrowError(err error) *Value + func (c *Context) ThrowInternalError(format string, args ...any) *Value + func (c *Context) ThrowRangeError(format string, args ...any) *Value + func (c *Context) ThrowReferenceError(format string, args ...any) *Value + func (c *Context) ThrowSyntaxError(format string, args ...any) *Value + func (c *Context) ThrowTypeError(format string, args ...any) *Value + type EvalOption struct + func (o *EvalOption) Free() + func (o *EvalOption) Handle() (handle uint64) + type EvalOptionFunc func(*EvalOption) + func Bytecode(buf []byte) EvalOptionFunc + func Code(code string) EvalOptionFunc + func FlagAsync() EvalOptionFunc + func FlagBacktraceBarrier() EvalOptionFunc + func FlagCompileOnly() EvalOptionFunc + func FlagStrict() EvalOptionFunc + func FlagUnused() EvalOptionFunc + func TypeDirect() EvalOptionFunc + func TypeGlobal() EvalOptionFunc + func TypeIndirect() EvalOptionFunc + func TypeMask() EvalOptionFunc + func TypeModule() EvalOptionFunc + type FieldMapper struct + func NewFieldMapper() *FieldMapper + func (fm *FieldMapper) GetFieldMap(structType reflect.Type) map[string]FieldPath + type FieldPath struct + type Float interface + type Function func(ctx *This) (*Value, error) + type Handle struct + func NewHandle(runtime *Runtime, ptr uint64) *Handle + func (h *Handle) Bool() bool + func (h *Handle) Bytes() []byte + func (h *Handle) Float32() float32 + func (h *Handle) Float64() float64 + func (h *Handle) Free() + func (h *Handle) Int() int + func (h *Handle) Int16() int16 + func (h *Handle) Int32() int32 + func (h *Handle) Int64() int64 + func (h *Handle) Int8() int8 + func (h *Handle) IsFreed() bool + func (h *Handle) Raw() uint64 + func (h *Handle) String() string + func (h *Handle) Uint() uint + func (h *Handle) Uint16() uint16 + func (h *Handle) Uint32() uint32 + func (h *Handle) Uint64() uint64 + func (h *Handle) Uint8() uint8 + func (h *Handle) Uintptr() uintptr + type Integer interface + type JSAtom uint32 + type JSPropertyEnum struct + type JsArrayToGoConverter struct + func NewJsArrayToGoConverter[T any](input *Value, samples ...T) *JsArrayToGoConverter[T] + func (ac *JsArrayToGoConverter[T]) Convert() (T, error) + type JsFunctionProxy = func(ctx context.Context, module api.Module, jsCtx uint32, thisVal uint64, ...) (rs uint64) + type JsNumericToGoConverter struct + func NewJsNumericToGoConverter(targetType reflect.Type) *JsNumericToGoConverter + func (nc *JsNumericToGoConverter) Convert(floatVal float64) (any, error) + type Map struct + func NewMap(value *Value) *Map + func (m *Map) CreateObject() *Value + func (m *Map) Delete(key *Value) + func (m *Map) ForEach(forFn func(key, value *Value)) + func (m *Map) Get(key *Value) *Value + func (m *Map) Has(key *Value) bool + func (m *Map) IsMap() bool + func (m *Map) IsObject() bool + func (m *Map) JSONStringify() (string, error) + func (m *Map) Set(key, value *Value) + func (m *Map) ToMap() *Map + type Mem struct + func (m *Mem) MustRead(addr uint32, size uint64) []byte + func (m *Mem) MustWrite(addr uint32, b []byte) + func (m *Mem) Read(addr uint32, size uint64) ([]byte, error) + func (m *Mem) ReadFloat64(ptr uint32) (float64, error) + func (m *Mem) ReadString(addr, maxlen uint32) (string, error) + func (m *Mem) ReadUint32(ptr uint32) (uint32, error) + func (m *Mem) ReadUint64(ptr uint32) (uint64, error) + func (m *Mem) ReadUint8(ptr uint32) (uint8, error) + func (m *Mem) Size() uint32 + func (m *Mem) StringFromPackedPtr(ptr uint64) string + func (m *Mem) UnpackPtr(packedPtr uint64) (uint32, uint32) + func (m *Mem) Write(addr uint32, b []byte) error + func (m *Mem) WriteFloat64(ptr uint32, v float64) error + func (m *Mem) WriteString(ptr uint32, s string) error + func (m *Mem) WriteUint32(ptr uint32, v uint32) error + func (m *Mem) WriteUint64(ptr uint32, v uint64) error + func (m *Mem) WriteUint8(ptr uint32, v uint8) error + type NumberType interface + type ObjectOrMap interface + ForEach func(callback func(*Value, *Value)) + IsMap func() bool + IsNull func() bool + IsObject func() bool + JSONStringify func() (string, error) + ToMap func() *Map + type Option struct + CWD string + CacheDir string + CloseOnContextDone bool + Context context.Context + DisableBuildCache bool + GCThreshold int + MaxExecutionTime int + MaxStackSize int + MemoryLimit int + ProxyFunction any + QuickJSWasmBytes []byte + StartFunctionName string + Stderr io.Writer + Stdout io.Writer + type OwnProperty struct + func (p OwnProperty) String() string + type Pool struct + func NewPool(size int, option Option, setupFuncs ...func(*Runtime) error) *Pool + func (p *Pool) Get() (*Runtime, error) + func (p *Pool) Put(rt *Runtime) + type ProxyRegistry struct + func NewProxyRegistry() *ProxyRegistry + func (r *ProxyRegistry) Clear() + func (r *ProxyRegistry) Get(id uint64) (any, bool) + func (r *ProxyRegistry) Len() int + func (r *ProxyRegistry) Register(fn any) uint64 + func (r *ProxyRegistry) Unregister(id uint64) bool + type Runtime struct + func New(options ...Option) (runtime *Runtime, err error) + func (r *Runtime) Call(name string, args ...uint64) *Handle + func (r *Runtime) CallUnPack(name string, args ...uint64) (uint32, uint32) + func (r *Runtime) Close() + func (r *Runtime) Compile(file string, flags ...EvalOptionFunc) ([]byte, error) + func (r *Runtime) Context() *Context + func (r *Runtime) Eval(file string, flags ...EvalOptionFunc) (*Value, error) + func (r *Runtime) FreeHandle(ptr uint64) + func (r *Runtime) FreeJsValue(val uint64) + func (r *Runtime) FreeQJSRuntime() + func (r *Runtime) Load(file string, flags ...EvalOptionFunc) (*Value, error) + func (r *Runtime) Malloc(size uint64) uint64 + func (r *Runtime) Mem() *Mem + func (r *Runtime) NewBytesHandle(b []byte) *Handle + func (r *Runtime) NewStringHandle(v string) *Handle + func (r *Runtime) Raw() uint64 + func (r *Runtime) String() string + type Set struct + func NewSet(value *Value) *Set + func (s *Set) Add(value *Value) + func (s *Set) Delete(value *Value) + func (s *Set) ForEach(forFn func(value *Value)) + func (s *Set) Has(value *Value) bool + func (s *Set) JSONStringify() (string, error) + func (s *Set) ToArray() *Array + type Signed interface + type This struct + func (t *This) Args() []*Value + func (t *This) Context() *Context + func (t *This) IsAsync() bool + func (t *This) Promise() *Value + type Tracker struct + func NewTracker[T uintptr | uint64]() *Tracker[T] + func (tracker *Tracker[T]) GoArrayToJs(c *Context, rval reflect.Value) (*Value, error) + func (tracker *Tracker[T]) GoMapToJs(c *Context, rval reflect.Value) (*Value, error) + func (tracker *Tracker[T]) GoSliceToJs(c *Context, rval reflect.Value) (*Value, error) + func (tracker *Tracker[T]) GoStructToJs(c *Context, rtype reflect.Type, rval reflect.Value) (*Value, error) + func (tracker *Tracker[T]) Track(ptr T) bool + func (tracker *Tracker[T]) UnTrack(ptr T) + type Unsigned interface + type Value struct + func ChannelToJSObjectValue(c *Context, rtype reflect.Type, rval reflect.Value) (*Value, error) + func FuncToJS(c *Context, v any) (_ *Value, err error) + func GoComplexToJs[T complex64 | complex128](c *Context, z T) *Value + func GoFuncResultToJs(c *Context, results []reflect.Value) (*Value, error) + func GoMapToJs(c *Context, rval reflect.Value) (*Value, error) + func GoNumberToJs[T NumberType](c *Context, i T) *Value + func GoSliceToJs(c *Context, rval reflect.Value) (*Value, error) + func GoStructToJs(c *Context, rtype reflect.Type, rval reflect.Value) (*Value, error) + func ToJsValue(c *Context, v any) (*Value, error) + func (v *Value) Await() (*Value, error) + func (v *Value) BigInt() *big.Int + func (v *Value) Bool() bool + func (v *Value) ByteLen() int64 + func (v *Value) Bytes() []byte + func (v *Value) Call(name string, args ...uint64) *Value + func (v *Value) CallConstructor(args ...*Value) *Value + func (v *Value) Clone() *Value + func (v *Value) Context() *Context + func (v *Value) Ctx() uint64 + func (v *Value) DateTime(tzs ...string) *time.Time + func (v *Value) DeleteProperty(name string) bool + func (v *Value) Exception() error + func (v *Value) Float64() float64 + func (v *Value) ForEach(fn func(key *Value, value *Value)) + func (v *Value) Free() + func (v *Value) GetOwnProperties() []OwnProperty + func (v *Value) GetOwnPropertyNames() (_ []string, err error) + func (v *Value) GetProperty(name *Value) *Value + func (v *Value) GetPropertyIndex(index int64) *Value + func (v *Value) GetPropertyStr(name string) *Value + func (v *Value) Handle() *Handle + func (v *Value) HasProperty(name string) bool + func (v *Value) HasPropertyIndex(index int64) bool + func (v *Value) Int32() int32 + func (v *Value) Int64() int64 + func (v *Value) Invoke(fname string, args ...any) (_ *Value, err error) + func (v *Value) InvokeJS(fname string, args ...*Value) (*Value, error) + func (v *Value) IsArray() bool + func (v *Value) IsBigInt() bool + func (v *Value) IsBool() bool + func (v *Value) IsByteArray() bool + func (v *Value) IsConstructor() bool + func (v *Value) IsDate() bool + func (v *Value) IsError() bool + func (v *Value) IsFunction() bool + func (v *Value) IsGlobalInstanceOf(name string) bool + func (v *Value) IsInfinity() bool + func (v *Value) IsMap() bool + func (v *Value) IsNaN() bool + func (v *Value) IsNull() bool + func (v *Value) IsNumber() bool + func (v *Value) IsObject() bool + func (v *Value) IsPromise() bool + func (v *Value) IsQJSProxyValue() bool + func (v *Value) IsSet() bool + func (v *Value) IsString() bool + func (v *Value) IsSymbol() bool + func (v *Value) IsUndefined() bool + func (v *Value) IsUninitialized() bool + func (v *Value) JSONStringify() (_ string, err error) + func (v *Value) Len() int64 + func (v *Value) New(args ...*Value) *Value + func (v *Value) NewUndefined() *Value + func (v *Value) Object() *Value + func (v *Value) Raw() uint64 + func (v *Value) Reject(args ...*Value) error + func (v *Value) Resolve(args ...*Value) error + func (v *Value) SetProperty(name, val *Value) + func (v *Value) SetPropertyIndex(index int64, val *Value) + func (v *Value) SetPropertyStr(name string, val *Value) + func (v *Value) String() string + func (v *Value) ToArray() (*Array, error) + func (v *Value) ToByteArray() []byte + func (v *Value) ToMap() *Map + func (v *Value) ToSet() *Set + func (v *Value) Type() string + func (v *Value) Uint32() uint32