v8js

package module
v0.0.0-...-b97f8f7 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 5 Imported by: 1

README

v8js

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportRawValue

func ExportRawValue(v *JsValue, noRelease bool) *v8go.Value

Types

type Consumed

type Consumed struct {
	*JsValue
	// contains filtered or unexported fields
}

Consumed Should be used to wrap a JsValue that is consumed by a function call. You should not use JsValue directly after calling a function that consumes it.

func (*Consumed) Release

func (c *Consumed) Release()

type Context

type Context struct {
	Raw *v8go.Context
	// contains filtered or unexported fields
}

func NewContext

func NewContext(opt ...v8go.ContextOption) *Context

func (*Context) Close

func (c *Context) Close()

func (*Context) Global

func (c *Context) Global() *JsValue

func (*Context) NewArray

func (c *Context) NewArray(values ...*Consumed) *JsValue

func (*Context) NewArrayBuffer

func (c *Context) NewArrayBuffer(data []byte) *JsValue

func (*Context) NewBigInt

func (c *Context) NewBigInt(val *big.Int) *JsValue

func (*Context) NewBoolean

func (c *Context) NewBoolean(val bool) *JsValue

func (*Context) NewFunction

func (c *Context) NewFunction(callback FunctionCallback) *JsValue

func (*Context) NewFunctionTemplate

func (c *Context) NewFunctionTemplate(callback FunctionCallback) *FunctionTemplate

func (*Context) NewInt32

func (c *Context) NewInt32(val int32) *JsValue

func (*Context) NewInt64

func (c *Context) NewInt64(val int64) *JsValue

func (*Context) NewNumber

func (c *Context) NewNumber(val float64) *JsValue

func (*Context) NewObject

func (c *Context) NewObject() *JsValue

func (*Context) NewString

func (c *Context) NewString(val string) *JsValue

func (*Context) NewStringArray

func (c *Context) NewStringArray(values ...string) *JsValue

func (*Context) NullValue

func (c *Context) NullValue() *JsValue

func (*Context) RunScript

func (c *Context) RunScript(script string, name string) *JsValue

func (*Context) Wrap

func (c *Context) Wrap(v *v8go.Value) *JsValue

type FunctionCallback

type FunctionCallback func(info *FunctionCallbackInfo) *Consumed

type FunctionCallbackInfo

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

func NewFunctionCallbackInfo

func NewFunctionCallbackInfo(ctx *Context, this *Consumed, args ...*Consumed) *FunctionCallbackInfo

func (*FunctionCallbackInfo) Args

func (i *FunctionCallbackInfo) Args() []*Consumed

Args returns a slice of the value arguments that are passed to the JS function.

func (*FunctionCallbackInfo) Context

func (i *FunctionCallbackInfo) Context() *Context

func (*FunctionCallbackInfo) GetArg

func (i *FunctionCallbackInfo) GetArg(idx int) *Consumed

func (*FunctionCallbackInfo) This

func (i *FunctionCallbackInfo) This() *Consumed

This returns the receiver object "this".

type FunctionTemplate

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

func (*FunctionTemplate) GetFunction

func (t *FunctionTemplate) GetFunction(ctx *Context) *JsValue

type JsValue

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

JsValue is a wrapper for v8go.Value

YOU MUST CALL Release() ON CONSUMED METHOD WHEN YOU FINISH USING IT.

OR YOU CAN CALL CONSUM() METHOD TO GET A CONSUMED VALUE AND PASS IT TO FUNCTION CALL.

func (*JsValue) Array

func (v *JsValue) Array() []*JsValue

func (*JsValue) ArrayBufferContent

func (v *JsValue) ArrayBufferContent() []byte

func (*JsValue) BigInt

func (v *JsValue) BigInt() *big.Int

func (*JsValue) Boolean

func (v *JsValue) Boolean() bool

func (*JsValue) Call

func (v *JsValue) Call(recvr *JsValue, args ...*Consumed) *JsValue

func (*JsValue) Consume

func (v *JsValue) Consume() *Consumed

func (*JsValue) ConsumeReuseble

func (v *JsValue) ConsumeReuseble() *Reusable

Reuse returns a reusable value that can be used to avoid unnecessary allocations. You should call Dispoe() or FinalConsume() on the returned value when you finish using it. You should not call Consume() on JsValue if you call ConsumeReuseble() on it.

func (*JsValue) Delete

func (v *JsValue) Delete(key string) bool

func (*JsValue) DeleteIdx

func (v *JsValue) DeleteIdx(idx uint32) bool

func (*JsValue) Get

func (v *JsValue) Get(key string) *JsValue

func (*JsValue) GetIdx

func (v *JsValue) GetIdx(idx uint32) *JsValue

func (*JsValue) Has

func (v *JsValue) Has(key string) bool

func (*JsValue) HasIdx

func (v *JsValue) HasIdx(idx uint32) bool

func (*JsValue) Int32

func (v *JsValue) Int32() int32

func (*JsValue) Integer

func (v *JsValue) Integer() int64

func (*JsValue) IsArray

func (v *JsValue) IsArray() bool

func (*JsValue) IsArrayBuffer

func (v *JsValue) IsArrayBuffer() bool

func (*JsValue) IsBigInt

func (v *JsValue) IsBigInt() bool

func (*JsValue) IsBoolean

func (v *JsValue) IsBoolean() bool

func (*JsValue) IsDate

func (v *JsValue) IsDate() bool

func (*JsValue) IsFalse

func (v *JsValue) IsFalse() bool

func (*JsValue) IsFunction

func (v *JsValue) IsFunction() bool

func (*JsValue) IsInt32

func (v *JsValue) IsInt32() bool

func (*JsValue) IsMap

func (v *JsValue) IsMap() bool

func (*JsValue) IsNativeError

func (v *JsValue) IsNativeError() bool

func (*JsValue) IsNull

func (v *JsValue) IsNull() bool

func (*JsValue) IsNullOrUndefined

func (v *JsValue) IsNullOrUndefined() bool

func (*JsValue) IsNumber

func (v *JsValue) IsNumber() bool

func (*JsValue) IsObject

func (v *JsValue) IsObject() bool

func (*JsValue) IsRegExp

func (v *JsValue) IsRegExp() bool

func (*JsValue) IsSet

func (v *JsValue) IsSet() bool

func (*JsValue) IsTrue

func (v *JsValue) IsTrue() bool

func (*JsValue) IsUint32

func (v *JsValue) IsUint32() bool

func (*JsValue) IsUndefined

func (v *JsValue) IsUndefined() bool

func (*JsValue) MethodCall

func (v *JsValue) MethodCall(methodName string, args ...*Consumed) *JsValue

func (*JsValue) MustMarshalJSON

func (v *JsValue) MustMarshalJSON() []byte

func (*JsValue) Number

func (v *JsValue) Number() float64

func (*JsValue) Release

func (v *JsValue) Release()

func (*JsValue) SameValue

func (v *JsValue) SameValue(other *JsValue) bool

func (*JsValue) Set

func (v *JsValue) Set(key string, val *Consumed)

func (*JsValue) SetIdx

func (v *JsValue) SetIdx(idx uint32, val *Consumed)

func (*JsValue) SetObjectMethod

func (v *JsValue) SetObjectMethod(ctx *Context, name string, fn FunctionCallback)

func (*JsValue) String

func (v *JsValue) String() string

func (*JsValue) StringArrry

func (v *JsValue) StringArrry() []string

func (*JsValue) Uint32

func (v *JsValue) Uint32() uint32

type Reusable

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

func (*Reusable) Consume

func (r *Reusable) Consume() *Consumed

func (*Reusable) Dispose

func (r *Reusable) Dispose()

func (*Reusable) FinalConsume

func (r *Reusable) FinalConsume() *Consumed

Directories

Path Synopsis
plugins

Jump to

Keyboard shortcuts

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