refactor(navigation): update interfaces

This commit is contained in:
Dan Bucholtz
2017-08-24 14:23:38 -05:00
parent 80be8b2ca3
commit 2dc36f7274
5 changed files with 16 additions and 8 deletions

View File

@ -1,5 +1,4 @@
import { Component, Element, Method, Prop } from '@stencil/core';
import { AnimationController, Config } from '../..';
import { ComponentDataPair, FrameworkDelegate, Nav, NavController, NavOptions, ViewController } from '../../navigation/nav-interfaces';
import { isReady } from '../../utils/helpers';
@ -25,9 +24,6 @@ let defaultDelegate: FrameworkDelegate = null;
export class NavControllerImpl implements NavController {
@Element() element: HTMLElement;
@Prop({ connect: 'ion-animation-controller' }) animationCtrl: AnimationController;
@Prop({ context: 'config' }) config: Config;
@Prop() delegate: FrameworkDelegate;
constructor() {

View File

@ -1,4 +1,4 @@
import { Component, Element, Event, EventEmitter, Method, Prop } from '@stencil/core';
import { Component, Element, Event, EventEmitter, Listen, Method, Prop } from '@stencil/core';
import { AnimationController, Config } from '../..';
import { ComponentDataPair, FrameworkDelegate, Nav, NavController, NavOptions, ViewController } from '../../navigation/nav-interfaces';
@ -118,16 +118,23 @@ export class IonNav implements Nav {
return getFirstView(this);
}
@Listen('navInit')
navInitialized(event: any) {
console.log('got the event: ', event);
}
render() {
return <slot></slot>;
}
}
export function ionViewDidLoadImpl(nav: Nav) {
nav.
nav.navInit.emit(nav);
if (nav.root) {
nav.setRoot(nav.root);
}
}
export function pushImpl(nav: Nav, component: any, data: any, opts: NavOptions) {

View File

@ -24,8 +24,6 @@ import { SegmentButton, SegmentButtonEvent } from './components/segment-button/s
import { Toast, ToastEvent, ToastOptions } from './components/toast/toast'
import { ToastController } from './components/toast-controller/toast-controller'
import * as Stencil from '@stencil/core';
import { TransitionBuilder } from './navigation/nav-interfaces';
export interface Config {

View File

@ -1,3 +1,5 @@
import { EventEmitter } from '@stencil/core';
import {
Animation,
AnimationController,
@ -25,7 +27,11 @@ export interface Nav {
parent?: Nav;
childNavs?: Nav[]; // TODO - make nav container
root?: any;
navInit?: EventEmitter;
config?: Config;
animationCtrl?: AnimationController;
// public methods
getActive(): ViewController;
getPrevious(view?: ViewController): ViewController;
getViews(): ViewController[];

View File

@ -166,6 +166,7 @@ export function isReady(element: HTMLElement) {
resolve(elm);
});
});
}
/** @hidden */
export function deepCopy(obj: any) {