Documentation ¶
Index ¶
- func CreateArray(env Env) (Value, Status)
- func CreateArrayWithLength(env Env, length int) (Value, Status)
- func CreateAsyncWork(env Env, asyncResource, asyncResourceName Value, execute AsyncExecuteCallback, ...) (AsyncWork, Status)
- func CreateDouble(env Env, value float64) (Value, Status)
- func CreateError(env Env, code, msg Value) (Value, Status)
- func CreateFunction(env Env, name string, cb Callback) (Value, Status)
- func CreateObject(env Env) (Value, Status)
- func CreatePromise(env Env) (Promise, Status)
- func CreateStringUtf8(env Env, str string) (Value, Status)
- func CreateSymbol(env Env, description Value) (Value, Status)
- func CreateThreadsafeFunction(env Env, fn Value, asyncResource, asyncResourceName Value, ...) (ThreadsafeFunction, Status)
- func DeleteCallbackData(cEnv C.napi_env, finalizeData, finalizeHint unsafe.Pointer)
- func DeleteInstanceData(env C.napi_env, finalizeData, finalizeHint unsafe.Pointer)
- func ExecuteAsyncCompleteCallback(cEnv C.napi_env, cStatus C.napi_status, cData unsafe.Pointer)
- func ExecuteAsyncExecuteCallback(cEnv C.napi_env, cData unsafe.Pointer)
- func ExecuteCallback(cEnv C.napi_env, cInfo C.napi_callback_info) C.napi_value
- func GetBoolean(env Env, value bool) (Value, Status)
- func GetCbInfo(env Env, info CallbackInfo) (GetCbInfoResult, Status)
- func GetGlobal(env Env) (Value, Status)
- func GetNodeVersion(env Env) (NodeVersion, Status)
- func GetNull(env Env) (Value, Status)
- func GetUndefined(env Env) (Value, Status)
- func Typeof(env Env, value Value) (ValueType, Status)
- type AsyncCompleteCallback
- type AsyncExecuteCallback
- type AsyncWork
- type AsyncWorkDataProvider
- type Callback
- type CallbackDataProvider
- type CallbackInfo
- type Deferred
- type Env
- type GetCbInfoResult
- type InstanceDataProvider
- type NapiGoAsyncWorkID
- type NapiGoAsyncWorkMapEntry
- type NapiGoCallbackID
- type NapiGoCallbackMapEntry
- type NapiGoInstanceAsyncWorkData
- func (d *NapiGoInstanceAsyncWorkData) CreateAsyncWork(env Env, asyncResource, asyncResourceName Value, execute AsyncExecuteCallback, ...) (AsyncWork, Status)
- func (d *NapiGoInstanceAsyncWorkData) DeleteAsyncWork(id NapiGoAsyncWorkID)
- func (d *NapiGoInstanceAsyncWorkData) GetAsyncWork(id NapiGoAsyncWorkID) *NapiGoAsyncWorkMapEntry
- type NapiGoInstanceAsyncWorkMap
- type NapiGoInstanceCallbackData
- type NapiGoInstanceCallbackMap
- type NapiGoInstanceData
- type NodeVersion
- type Promise
- type Status
- func AcquireThreadsafeFunction(fn ThreadsafeFunction) Status
- func CallThreadsafeFunction(fn ThreadsafeFunction) Status
- func CancelAsyncWork(env Env, work AsyncWork) Status
- func DeleteAsyncWork(env Env, work AsyncWork) Status
- func GetInstanceData(env Env) (any, Status)
- func GetModuleFileName(env Env) (string, Status)
- func GetValueBool(env Env, value Value) (bool, Status)
- func GetValueDouble(env Env, value Value) (float64, Status)
- func GetValueStringUtf8(env Env, value Value) (string, Status)
- func InitializeInstanceData(env Env) Status
- func QueueAsyncWork(env Env, work AsyncWork) Status
- func RejectDeferred(env Env, deferred Deferred, rejection Value) Status
- func ReleaseThreadsafeFunction(fn ThreadsafeFunction) Status
- func ResolveDeferred(env Env, deferred Deferred, resolution Value) Status
- func SetElement(env Env, object Value, index int, value Value) Status
- func SetInstanceData(env Env, data any) Status
- func SetProperty(env Env, object, key, value Value) Status
- func StrictEquals(env Env, lhs, rhs Value) (bool, Status)
- func Throw(env Env, err Value) Status
- func ThrowError(env Env, code, msg string) Status
- type StatusError
- type ThreadsafeFunction
- type Value
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateArray ¶
func CreateAsyncWork ¶
func CreateAsyncWork( env Env, asyncResource, asyncResourceName Value, execute AsyncExecuteCallback, complete AsyncCompleteCallback, ) (AsyncWork, Status)
func CreateObject ¶
func CreatePromise ¶
func DeleteCallbackData ¶
func DeleteInstanceData ¶
func ExecuteCallback ¶
func ExecuteCallback( cEnv C.napi_env, cInfo C.napi_callback_info, ) C.napi_value
func GetCbInfo ¶
func GetCbInfo(env Env, info CallbackInfo) (GetCbInfoResult, Status)
func GetNodeVersion ¶
func GetNodeVersion(env Env) (NodeVersion, Status)
func GetUndefined ¶
Types ¶
type AsyncCompleteCallback ¶
type AsyncExecuteCallback ¶
type AsyncExecuteCallback func(env Env)
type AsyncWork ¶
type AsyncWork struct { Handle unsafe.Pointer ID NapiGoAsyncWorkID }
type AsyncWorkDataProvider ¶
type AsyncWorkDataProvider interface { CreateAsyncWork( env Env, asyncResource, asyncResourceName Value, execute AsyncExecuteCallback, complete AsyncCompleteCallback, ) (AsyncWork, Status) GetAsyncWork(id NapiGoAsyncWorkID) *NapiGoAsyncWorkMapEntry DeleteAsyncWork(id NapiGoAsyncWorkID) }
type Callback ¶
type Callback func(env Env, info CallbackInfo) Value
type CallbackDataProvider ¶
type CallbackDataProvider interface { CreateCallback(env Env, name string, cb Callback) (Value, Status) GetCallback(id NapiGoCallbackID) *NapiGoCallbackMapEntry DeleteCallback(id NapiGoCallbackID) }
type CallbackInfo ¶
type GetCbInfoResult ¶
type InstanceDataProvider ¶
type InstanceDataProvider interface { GetUserData() any SetUserData(userData any) GetCallbackData() CallbackDataProvider GetAsyncWorkData() AsyncWorkDataProvider }
type NapiGoAsyncWorkID ¶
type NapiGoAsyncWorkID int
type NapiGoAsyncWorkMapEntry ¶
type NapiGoAsyncWorkMapEntry struct { Execute AsyncExecuteCallback Complete AsyncCompleteCallback ID NapiGoAsyncWorkID }
type NapiGoCallbackID ¶
type NapiGoCallbackID int
type NapiGoCallbackMapEntry ¶
type NapiGoCallbackMapEntry struct { Callback Callback ID NapiGoCallbackID }
type NapiGoInstanceAsyncWorkData ¶
type NapiGoInstanceAsyncWorkData struct { AsyncWorkMap NapiGoInstanceAsyncWorkMap NextID NapiGoAsyncWorkID Lock sync.RWMutex }
func (*NapiGoInstanceAsyncWorkData) CreateAsyncWork ¶
func (d *NapiGoInstanceAsyncWorkData) CreateAsyncWork( env Env, asyncResource, asyncResourceName Value, execute AsyncExecuteCallback, complete AsyncCompleteCallback, ) (AsyncWork, Status)
func (*NapiGoInstanceAsyncWorkData) DeleteAsyncWork ¶
func (d *NapiGoInstanceAsyncWorkData) DeleteAsyncWork(id NapiGoAsyncWorkID)
func (*NapiGoInstanceAsyncWorkData) GetAsyncWork ¶
func (d *NapiGoInstanceAsyncWorkData) GetAsyncWork( id NapiGoAsyncWorkID, ) *NapiGoAsyncWorkMapEntry
type NapiGoInstanceAsyncWorkMap ¶
type NapiGoInstanceAsyncWorkMap map[NapiGoAsyncWorkID]*NapiGoAsyncWorkMapEntry
type NapiGoInstanceCallbackData ¶
type NapiGoInstanceCallbackData struct { CallbackMap NapiGoInstanceCallbackMap NextID NapiGoCallbackID Lock sync.RWMutex }
func (*NapiGoInstanceCallbackData) CreateCallback ¶
func (*NapiGoInstanceCallbackData) DeleteCallback ¶
func (d *NapiGoInstanceCallbackData) DeleteCallback(id NapiGoCallbackID)
func (*NapiGoInstanceCallbackData) GetCallback ¶
func (d *NapiGoInstanceCallbackData) GetCallback( id NapiGoCallbackID, ) *NapiGoCallbackMapEntry
type NapiGoInstanceCallbackMap ¶
type NapiGoInstanceCallbackMap map[NapiGoCallbackID]*NapiGoCallbackMapEntry
type NapiGoInstanceData ¶
type NapiGoInstanceData struct { UserData any CallbackData NapiGoInstanceCallbackData AsyncWorkData NapiGoInstanceAsyncWorkData }
func (*NapiGoInstanceData) GetAsyncWorkData ¶
func (d *NapiGoInstanceData) GetAsyncWorkData() AsyncWorkDataProvider
func (*NapiGoInstanceData) GetCallbackData ¶
func (d *NapiGoInstanceData) GetCallbackData() CallbackDataProvider
func (*NapiGoInstanceData) GetUserData ¶
func (d *NapiGoInstanceData) GetUserData() any
func (*NapiGoInstanceData) SetUserData ¶
func (d *NapiGoInstanceData) SetUserData(userData any)
type Status ¶
type Status int
const ( StatusOK Status = C.napi_ok StatusInvalidArg Status = C.napi_invalid_arg StatusObjectExpected Status = C.napi_object_expected StatusStringExpected Status = C.napi_string_expected StatusNameExpected Status = C.napi_name_expected StatusFunctionExpected Status = C.napi_function_expected StatusNumberExpected Status = C.napi_number_expected StatusBooleanExpected Status = C.napi_boolean_expected StatusArrayExpected Status = C.napi_array_expected StatusGenericFailure Status = C.napi_generic_failure StatusPendingException Status = C.napi_pending_exception StatusCancelled Status = C.napi_cancelled StatusEscapeCalledTwice Status = C.napi_escape_called_twice StatusHandleScopeMismatch Status = C.napi_handle_scope_mismatch StatusCallbackScopeMismatch Status = C.napi_callback_scope_mismatch StatusQueueFull Status = C.napi_queue_full StatusClosing Status = C.napi_closing StatusBigintExpected Status = C.napi_bigint_expected StatusDateExpected Status = C.napi_date_expected StatusArraybufferExpected Status = C.napi_arraybuffer_expected StatusDetachableArraybufferExpected Status = C.napi_detachable_arraybuffer_expected StatusWouldDeadlock Status = C.napi_would_deadlock )
func AcquireThreadsafeFunction ¶
func AcquireThreadsafeFunction(fn ThreadsafeFunction) Status
func CallThreadsafeFunction ¶
func CallThreadsafeFunction( fn ThreadsafeFunction, ) Status
func CancelAsyncWork ¶
func DeleteAsyncWork ¶
func GetInstanceData ¶
func GetModuleFileName ¶
func InitializeInstanceData ¶
func QueueAsyncWork ¶
func ReleaseThreadsafeFunction ¶
func ReleaseThreadsafeFunction( fn ThreadsafeFunction, ) Status
func SetInstanceData ¶
func SetProperty ¶
func ThrowError ¶
type StatusError ¶
type StatusError Status
func (StatusError) Error ¶
func (err StatusError) Error() string
type ThreadsafeFunction ¶
type ValueType ¶
type ValueType int
const ( ValueTypeUndefined ValueType = C.napi_undefined ValueTypeNull ValueType = C.napi_null ValueTypeBoolean ValueType = C.napi_boolean ValueTypeNumber ValueType = C.napi_number ValueTypeString ValueType = C.napi_string ValueTypeSymbol ValueType = C.napi_symbol ValueTypeObject ValueType = C.napi_object ValueTypeFunction ValueType = C.napi_function ValueTypeExternal ValueType = C.napi_external ValueTypeBigint ValueType = C.napi_bigint )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.