Skip to content

API Reference / @gtkx/runtime / wrapHandle

Function: wrapHandle()

Call Signature

wrapHandle(handle, cls?): null

Defined in: packages/runtime/dist/registry.d.ts:183

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), and hands back an instance that already carries a handle unchanged; with an explicit class, creates a bare instance backed by the handle, of the subclass the class's registerWrapperClassResolver resolver picks when it has one. 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: packages/runtime/dist/registry.d.ts:184

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), and hands back an instance that already carries a handle unchanged; with an explicit class, creates a bare instance backed by the handle, of the subclass the class's registerWrapperClassResolver resolver picks when it has one. 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: packages/runtime/dist/registry.d.ts:185

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), and hands back an instance that already carries a handle unchanged; with an explicit class, creates a bare instance backed by the handle, of the subclass the class's registerWrapperClassResolver resolver picks when it has one. 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(handle, cls?): TypedClass

Defined in: packages/runtime/dist/registry.d.ts:186

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), and hands back an instance that already carries a handle unchanged; with an explicit class, creates a bare instance backed by the handle, of the subclass the class's registerWrapperClassResolver resolver picks when it has one. Returns null for a null or undefined handle.

Parameters

handle

ExternalObject<Handle>

Native handle to wrap.

cls?

AnyClass

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

Returns

TypedClass

Call Signature

wrapHandle(handle, cls?): TypedClass | null

Defined in: packages/runtime/dist/registry.d.ts:187

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), and hands back an instance that already carries a handle unchanged; with an explicit class, creates a bare instance backed by the handle, of the subclass the class's registerWrapperClassResolver resolver picks when it has one. Returns null for a null or undefined handle.

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

TypedClass | null

Released under the MPL-2.0 License.