feat(angular): add tabs events (#17125)

* feat(angular): add tabs events

* lint
This commit is contained in:
Manu MA
2019-01-15 22:07:53 +01:00
committed by GitHub
parent 0693c887f9
commit 6929bb817c
7 changed files with 72 additions and 26 deletions

View File

@ -1,6 +1,6 @@
import { ComponentRef } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { RouterDirection } from '@ionic/core';
import { NavDirection, RouterDirection } from '@ionic/core';
export function insertView(views: RouteView[], view: RouteView, direction: RouterDirection) {
if (direction === 'root') {
@ -44,7 +44,7 @@ export function getUrl(router: Router, activatedRoute: ActivatedRoute) {
export function isTabSwitch(enteringView: RouteView, leavingView: RouteView | undefined) {
if (!leavingView) {
return false;
return true;
}
return enteringView.stackId !== leavingView.stackId;
}
@ -80,6 +80,13 @@ export function destroyView(view: RouteView | undefined) {
}
}
export interface StackEvent {
enteringView: RouteView;
direction: RouterDirection;
animation: NavDirection | undefined;
tabSwitch: boolean;
}
export interface RouteView {
id: number;
url: string;