mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
refactor(navigation): update interfaces
This commit is contained in:
@ -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() {
|
||||
|
@ -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) {
|
||||
|
2
packages/core/src/index.d.ts
vendored
2
packages/core/src/index.d.ts
vendored
@ -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 {
|
||||
|
@ -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[];
|
||||
|
@ -166,6 +166,7 @@ export function isReady(element: HTMLElement) {
|
||||
resolve(elm);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
export function deepCopy(obj: any) {
|
||||
|
Reference in New Issue
Block a user