feat: return if the pop on NavController was successful (#27404)

Issue number: Resolves #27403 

---------

## What is the current behavior?

NavController.pop() returns `Promise<void>`.

## What is the new behavior?

NavController.pop() returns `Promise<boolean>` propagating success/fail
from underlying outlet.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

---------
This commit is contained in:
Andrzej
2023-05-18 23:17:13 +02:00
committed by GitHub
parent bddff105ce
commit e80f0b2409

View File

@@ -131,17 +131,21 @@ export class NavController {
*
* It recursively finds the top active `ion-router-outlet` and calls `pop()`.
* This is the recommended way to go back when you are using `ion-router-outlet`.
*
* Resolves to `true` if it was able to pop.
*/
async pop(): Promise<void> {
async pop(): Promise<boolean> {
let outlet = this.topOutlet;
while (outlet) {
if (await outlet.pop()) {
break;
return true;
} else {
outlet = outlet.parentOutlet;
}
}
return false;
}
/**