napi

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

func GetInstanceData

func GetInstanceData(env Env) (interface{}, error)

func SetInstanceData

func SetInstanceData(env Env, data interface{}, finalizeFunc finalizeFunc) error

func SetModuleInit

func SetModuleInit(init func(env Env, exports Value) (Value, error))

Types

type Callback

type Callback C.napi_callback

func MakeNapiCallback

func MakeNapiCallback(cb callbackFunc) (Callback, unsafe.Pointer, cleanupFunc)

type CallbackInfo

type CallbackInfo C.napi_callback_info

type Env

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

func (Env) CallFunction

func (env Env) CallFunction(recv Value, fun Value, argv []Value) (Value, error)

func (Env) CheckObjectTypeTag

func (env Env) CheckObjectTypeTag(jsObject Value, typeTag *TypeTag) (bool, error)

func (Env) CreateArrayWithLength

func (env Env) CreateArrayWithLength(length int) (Value, error)

func (Env) CreateDouble

func (env Env) CreateDouble(value float64) (Value, error)

func (Env) CreateFunction

func (env Env) CreateFunction(name string, data unsafe.Pointer, cb Callback) (Value, error)

func (Env) CreateInt64

func (env Env) CreateInt64(value int64) (Value, error)

func (Env) CreateObject

func (env Env) CreateObject() (Value, error)

func (Env) CreateReference

func (env Env) CreateReference(value Value, initialRefcount uint32) (Ref, error)

func (Env) CreateString

func (env Env) CreateString(str string) (Value, error)

func (Env) CreateUint32

func (env Env) CreateUint32(value uint32) (Value, error)

func (Env) DefineClass

func (env Env) DefineClass(name string, constructor Callback, data unsafe.Pointer, properties []PropertyDescriptor) (Value, error)

func (Env) DefineProperties

func (env Env) DefineProperties(object Value, properties []PropertyDescriptor) error

func (Env) DeleteReference

func (env Env) DeleteReference(ref Ref) error

func (Env) FatalException

func (env Env) FatalException(errValue Value) error

func (Env) GetAllPropertyNames

func (env Env) GetAllPropertyNames(object Value, keyMode KeyCollectionMode, keyFilter KeyFilter, keyConversion KeyConversion) (Value, error)

func (Env) GetArrayLength

func (env Env) GetArrayLength(value Value) (uint32, error)

func (Env) GetBoolean

func (env Env) GetBoolean(value bool) (Value, error)

func (Env) GetCbInfo

func (env Env) GetCbInfo(cbinfo CallbackInfo, argc *int, argv *Value, thisArg *Value, data *unsafe.Pointer) error

func (Env) GetElement

func (env Env) GetElement(object Value, index uint32) (Value, error)

func (Env) GetInstanceData

func (env Env) GetInstanceData() (unsafe.Pointer, error)

func (Env) GetLastErrorInfo

func (env Env) GetLastErrorInfo() (*ExtendedErrorInfo, error)

func (Env) GetNull

func (env Env) GetNull() (Value, error)

func (Env) GetProperty

func (env Env) GetProperty(object Value, key Value) (Value, error)

func (Env) GetPropertyNames

func (env Env) GetPropertyNames(object Value) (Value, error)

func (Env) GetReferenceValue

func (env Env) GetReferenceValue(ref Ref) (Value, error)

func (Env) GetUndefined

func (env Env) GetUndefined() (Value, error)

func (Env) GetValueBigintWords

func (env Env) GetValueBigintWords(value Value, signBit *int, wordCount *int, words *uint64) error

func (Env) GetValueBool

func (env Env) GetValueBool(value Value) (bool, error)

func (Env) GetValueDouble

func (env Env) GetValueDouble(value Value) (float64, error)

func (Env) GetValueString

func (env Env) GetValueString(value Value, buf []byte) (int, error)

func (Env) IsArray

func (env Env) IsArray(value Value) (bool, error)

func (Env) IsExceptionPending

func (env Env) IsExceptionPending() (bool, error)

func (Env) NewInstance

func (env Env) NewInstance(cons Value, argv []Value) (Value, error)

func (Env) ReferenceRef

func (env Env) ReferenceRef(ref Ref) (uint32, error)

func (Env) ReferenceUnref

func (env Env) ReferenceUnref(ref Ref) (uint32, error)

func (Env) SetElement

func (env Env) SetElement(object Value, index uint32, value Value) error

func (Env) SetInstanceData

func (env Env) SetInstanceData(data unsafe.Pointer, finalizeCb Finalize, finalizeHint unsafe.Pointer) error

func (Env) SetProperty

func (env Env) SetProperty(object Value, key Value, value Value) error

func (Env) ThrowError

func (env Env) ThrowError(code string, msg string) error

func (Env) ThrowTypeError

func (env Env) ThrowTypeError(code string, msg string) error

func (Env) TypeTagObject

func (env Env) TypeTagObject(jsObject Value, typeTag *TypeTag) error

func (Env) Typeof

func (env Env) Typeof(value Value) (ValueType, error)

func (Env) Unwrap

func (env Env) Unwrap(jsObject Value) (unsafe.Pointer, error)

func (Env) Wrap

func (env Env) Wrap(jsObject Value, nativeObject unsafe.Pointer, finalizeCb Finalize, finalizeHint unsafe.Pointer) error

type ExtendedErrorInfo

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

type Finalize

type Finalize C.napi_finalize

type KeyCollectionMode

type KeyCollectionMode C.napi_key_collection_mode

type KeyConversion

type KeyConversion C.napi_key_conversion

type KeyFilter

type KeyFilter C.napi_key_filter

type PropertyDescriptor

type PropertyDescriptor struct {
	Name Value

	Method Callback
	Getter Callback
	Setter Callback
	Value  Value

	Attributes PropertyAttributes
	Data       unsafe.Pointer
}

type Ref

type Ref C.napi_ref

type SafeWrapper

type SafeWrapper[T any] struct {
	// contains filtered or unexported fields
}

func NewSafeWrapper

func NewSafeWrapper[T any](tag1 uint64, tag2 uint64) SafeWrapper[T]

func (*SafeWrapper[T]) Unwrap

func (sfw *SafeWrapper[T]) Unwrap(env Env, jsObject Value) (*T, error)

func (*SafeWrapper[T]) Wrap

func (sfw *SafeWrapper[T]) Wrap(env Env, jsObject Value, goObject *T, finalizeFunc finalizeFunc) error

type TypeTag

type TypeTag C.napi_type_tag

type Value

type Value C.napi_value

Jump to

Keyboard shortcuts

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