Skip to content

API Reference / @gtkx/runtime / wrapHandle

Function: wrapHandle()

Call Signature

wrapHandle(handle, cls?): null

Defined in: runtime/dist/registry.d.ts:48

Wraps a native handle in a JS wrapper instance. With no class, resolves and reuses the wrapper for the handle's runtime GType (composing interface mixins); with an explicit class, creates a bare instance backed by the handle. Returns null for a null or undefined handle.

Parameters

handle

null | undefined

Native handle to wrap.

cls?

AnyClass

Wrapper class to instantiate, or omitted to resolve it from the runtime type.

Returns

null

Call Signature

wrapHandle<T>(handle, cls): T

Defined in: runtime/dist/registry.d.ts:49

Wraps a native handle in a JS wrapper instance. With no class, resolves and reuses the wrapper for the handle's runtime GType (composing interface mixins); with an explicit class, creates a bare instance backed by the handle. Returns null for a null or undefined handle.

Type Parameters

T

T extends object

Parameters

handle

ExternalObject<Handle>

Native handle to wrap.

cls

AnyClass<T>

Wrapper class to instantiate, or omitted to resolve it from the runtime type.

Returns

T

Call Signature

wrapHandle<T>(handle, cls): T | null

Defined in: runtime/dist/registry.d.ts:50

Wraps a native handle in a JS wrapper instance. With no class, resolves and reuses the wrapper for the handle's runtime GType (composing interface mixins); with an explicit class, creates a bare instance backed by the handle. Returns null for a null or undefined handle.

Type Parameters

T

T extends object

Parameters

handle

ExternalObject<Handle> | null | undefined

Native handle to wrap.

cls

AnyClass<T>

Wrapper class to instantiate, or omitted to resolve it from the runtime type.

Returns

T | null

Call Signature

wrapHandle<T>(handle, cls?): T

Defined in: runtime/dist/registry.d.ts:51

Wraps a native handle in a JS wrapper instance. With no class, resolves and reuses the wrapper for the handle's runtime GType (composing interface mixins); with an explicit class, creates a bare instance backed by the handle. Returns null for a null or undefined handle.

Type Parameters

T

T extends object = TypedClass

Parameters

handle

ExternalObject<Handle>

Native handle to wrap.

cls?

AnyClass

Wrapper class to instantiate, or omitted to resolve it from the runtime type.

Returns

T

Call Signature

wrapHandle<T>(handle, cls?): T | null

Defined in: runtime/dist/registry.d.ts:52

Wraps a native handle in a JS wrapper instance. With no class, resolves and reuses the wrapper for the handle's runtime GType (composing interface mixins); with an explicit class, creates a bare instance backed by the handle. Returns null for a null or undefined handle.

Type Parameters

T

T extends object = TypedClass

Parameters

handle

ExternalObject<Handle> | null | undefined

Native handle to wrap.

cls?

AnyClass

Wrapper class to instantiate, or omitted to resolve it from the runtime type.

Returns

T | null

Released under the MPL-2.0 License.