fix(nav): getLength is part of the public API (#28832)

resolves #28826

BREAKING CHANGE: `getLength` returns `Promise<number>` instead of `<number>`. This method was not previously available in Nav's TypeScript interface, but developers could still access it by casting Nav as `any`. Developers should ensure they `await` their `getLength` call before accessing the returned value.
This commit is contained in:
Liam DeBeasi
2024-01-16 11:54:25 -05:00
committed by GitHub
parent 76f6362410
commit 4fd05b6416
5 changed files with 52 additions and 38 deletions

View File

@ -483,8 +483,12 @@ export class Nav implements NavOutlet {
return this.getPreviousSync(view);
}
getLength() {
return this.views.length;
/**
* Returns the number of views in the stack.
*/
@Method()
async getLength(): Promise<number> {
return Promise.resolve(this.views.length);
}
private getActiveSync(): ViewController | undefined {