Skip to content

API Reference / @gtkx/runtime / registerWrapperClassResolver

Function: registerWrapperClassResolver() ​

registerWrapperClassResolver(cls, resolver): void

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

Lets a class registered with registerWrapperClass pick a subclass for each handle it wraps, for types whose one GType covers several C-level subtypes, the way a cairo surface reports image or recording through cairo_surface_get_type. The resolver runs when a handle is wrapped as that class explicitly, the way a boxed value a binding hands back is; a wrapper resolved from a handle's runtime GType never consults it, and a subclass passed to wrapHandle directly is used as given.

Parameters ​

cls ​

AnyClass

Registered wrapper class whose handles the resolver classifies.

resolver ​

WrapperClassResolver

Returns the class to instantiate for one handle, cls itself included.

Returns ​

void

Throws ​

If cls is not a registered wrapper class.