diff --git a/lib/navigation/view.ts b/lib/navigation/view.ts index 8c8a33d8..911aab32 100644 --- a/lib/navigation/view.ts +++ b/lib/navigation/view.ts @@ -70,6 +70,12 @@ interface ViewData { * haven't customized their sorting column */ defaultSortKey?: string + + /** + * Method called to load child views if any + */ + // eslint-disable-next-line no-use-before-define + loadChildViews?: (view: View) => Promise } export class View implements ViewData { @@ -157,6 +163,10 @@ export class View implements ViewData { return this._view.defaultSortKey } + get loadChildViews() { + return this._view.loadChildViews + } + } /** @@ -222,5 +232,9 @@ const isValidView = function(view: ViewData): boolean { throw new Error('View defaultSortKey must be a string') } + if (view.loadChildViews && typeof view.loadChildViews !== 'function') { + throw new Error('View loadChildViews must be a function') + } + return true }