Skip to content

API Reference / @gtkx/runtime / fromNative

Function: fromNative() ​

fromNative(descriptor, value): unknown

Defined in: packages/runtime/dist/native-value.d.ts:15

Converts a raw value returned from native code into its JavaScript form, wrapping object, struct, boxed, and fundamental handles and recursively converting arrays and hash tables according to the descriptor. A callback decoded from a native function pointer and its bound user data becomes a callable function that invokes the native callback; it stays valid only as long as the native caller keeps the pointer pair alive, which for an async-scoped callback means until the first invocation — calling one a second time throws instead of reaching the released native closure.

Parameters ​

descriptor ​

Descriptor

Describes the native type of the value.

value ​

unknown

The raw native value to convert.

Returns ​

unknown