Skip to content

API Reference / @gtkx/runtime / callParent

Function: callParent()

callParent(klass, methodName, instance, ...inputs): unknown

Defined in: packages/runtime/dist/vfunc-call.d.ts:16

Calls the implementation of a virtual function that the parent type of klass provides, so an override can chain up to the behavior it replaces. klass is the class whose override is running, named lexically rather than taken from instance, so each level of a hierarchy reaches exactly one level up. Arguments and the return value follow the same convention the override itself uses: pure out parameters are left out and returned instead, and a slot with several outputs returns them as a tuple. Throws if klass was never registered, inherits no such slot, or the parent type leaves the slot empty.

Parameters

klass

AnyClass

The registered class whose override is chaining up.

methodName

string

Name of the overridden method, such as vfuncMeasure.

instance

object

The instance the override was invoked on.

inputs

...unknown[]

The arguments the override received.

Returns

unknown

Released under the MPL-2.0 License.