9.0 Released! → Native ESM runtimes 🚀, Vite support ⚡️, multi-window apps and more...
Read Announcement
ts
function getAncestor<T>(view: T, criterion: string | (() => any)): T;

Defined in: ui/core/view-base/index.ts

Gets an ancestor from a given type.

Type Parameters

Type ParameterDefault type
T extends ViewBaseViewBase

Parameters

ParameterTypeDescription
viewTStarting view (child view).
criterionstring | (() => any)The type of ancestor view we are looking for. Could be a string containing a class name or an actual type. Returns an instance of a view (if found), otherwise undefined.

Returns

T