refactor(all): remove ionChange in non-inputs (#17101)

fixes #17071
This commit is contained in:
Manu MA
2019-01-14 21:43:24 +01:00
committed by GitHub
parent 3c801dbe11
commit d3b866b290
12 changed files with 29 additions and 70 deletions

View File

@ -166,12 +166,10 @@ Using tabs with Angular's router is fairly straight forward. Here you only need
## Events
| Event | Description | Type |
| ------------------ | -------------------------------------------------------------------------- | --------------------------------------- |
| `ionChange` | Emitted when the tab changes. | `CustomEvent<{tab: HTMLIonTabElement}>` |
| `ionNavDidChange` | Emitted when the navigation has finished transitioning to a new component. | `CustomEvent<void>` |
| `ionNavWillChange` | Emitted when the navigation is about to transition to a new component. | `CustomEvent<void>` |
| `ionNavWillLoad` | Emitted when the navigation will load a component. | `CustomEvent<void>` |
| Event | Description | Type |
| ------------------- | -------------------------------------------------------------------------- | ---------------------------- |
| `ionTabsDidChange` | Emitted when the navigation has finished transitioning to a new component. | `CustomEvent<{tab: string}>` |
| `ionTabsWillChange` | Emitted when the navigation is about to transition to a new component. | `CustomEvent<{tab: string}>` |
## Methods

View File

@ -23,25 +23,21 @@ export class Tabs implements NavOutlet {
/** @internal */
@Prop({ mutable: true }) useRouter = false;
/**
* Emitted when the tab changes.
*/
@Event() ionChange!: EventEmitter<{tab: HTMLIonTabElement}>;
/**
* Emitted when the navigation will load a component.
* @internal
*/
@Event() ionNavWillLoad!: EventEmitter<void>;
/**
* Emitted when the navigation is about to transition to a new component.
*/
@Event() ionNavWillChange!: EventEmitter<void>;
@Event({ bubbles: false }) ionTabsWillChange!: EventEmitter<{tab: string}>;
/**
* Emitted when the navigation has finished transitioning to a new component.
*/
@Event() ionNavDidChange!: EventEmitter<void>;
@Event({ bubbles: false }) ionTabsDidChange!: EventEmitter<{tab: string}>;
async componentWillLoad() {
if (!this.useRouter) {
@ -162,7 +158,7 @@ export class Tabs implements NavOutlet {
this.transitioning = true;
this.leavingTab = this.selectedTab;
this.selectedTab = selectedTab;
this.ionNavWillChange.emit();
this.ionTabsWillChange.emit({ tab: selectedTab.tab });
return selectedTab.setActive();
}
@ -180,8 +176,7 @@ export class Tabs implements NavOutlet {
if (leavingTab) {
leavingTab.active = false;
}
this.ionChange.emit({ tab: selectedTab });
this.ionNavDidChange.emit();
this.ionTabsDidChange.emit({ tab: selectedTab.tab });
}
}