diff --git a/ionic/animations/animation.ts b/ionic/animations/animation.ts index 4e6aa8d98f..94f7eac87b 100644 --- a/ionic/animations/animation.ts +++ b/ionic/animations/animation.ts @@ -130,7 +130,7 @@ export class Animation { return this; } - duration(value) { + duration(value?: number) { if (arguments.length) { this._duration = value; return this; @@ -145,7 +145,7 @@ export class Animation { } } - easing(name, opts) { + easing(name?: string, opts?: {}) { if (arguments.length) { this._easing = { name: name, @@ -156,7 +156,7 @@ export class Animation { return this._easing || (this._parent && this._parent.easing()); } - playbackRate(value) { + playbackRate(value?: number) { if (arguments.length) { this._rate = value; let i; @@ -237,7 +237,7 @@ export class Animation { } } - play(done) { + play(done?: Function) { const self = this; // the actual play() method which may or may not start async @@ -513,9 +513,9 @@ export class Animation { return this; } - clone() { + clone(): Animation { - function copy(dest, src) { + function copy(dest, src): Animation { // undo what stage() may have already done assign(dest, src); @@ -540,7 +540,7 @@ export class Animation { this._chld[i].dispose(removeElement); } for (i = 0; i < this._ani.length; i++) { - this._ani[i].dispose(removeElement); + this._ani[i].dispose(); } if (removeElement) { for (i = 0; i < this._el.length; i++) { diff --git a/ionic/components/menu/menu-types.ts b/ionic/components/menu/menu-types.ts index 1393cbe4c1..ecb131d526 100644 --- a/ionic/components/menu/menu-types.ts +++ b/ionic/components/menu/menu-types.ts @@ -10,11 +10,10 @@ import {Animation} from '../../animations/animation'; * @private */ export class MenuType { - - constructor() { - this.open = new Animation(); - this.close = new Animation(); - } + open: Animation = new Animation(); + close: Animation = new Animation(); + isOpening: boolean; + seek: Animation; setOpen(shouldOpen) { return new Promise(resolve => { diff --git a/ionic/components/menu/menu.ts b/ionic/components/menu/menu.ts index 3fdad8d0c6..23df4f54ef 100644 --- a/ionic/components/menu/menu.ts +++ b/ionic/components/menu/menu.ts @@ -1,4 +1,4 @@ -import {Component, forwardRef, Directive, Host, EventEmitter, ElementRef, NgZone} from 'angular2/core'; +import {Component, forwardRef, Directive, Host, EventEmitter, ElementRef, NgZone, Input} from 'angular2/core'; import {Ion} from '../ion'; import {IonicApp} from '../app/app'; @@ -6,6 +6,8 @@ import {Config} from '../../config/config'; import {Platform} from '../../platform/platform'; import {Keyboard} from '../../util/keyboard'; import * as gestures from './menu-gestures'; +import {Gesture} from '../../gestures/gesture'; +import {MenuType} from './menu-types'; /** @@ -91,13 +93,6 @@ import * as gestures from './menu-gestures'; */ @Component({ selector: 'ion-menu', - inputs: [ - 'content', - 'id', - 'side', - 'type', - 'maxEdgeStart' - ], defaultInputs: { 'side': 'left', 'menuType': 'reveal' @@ -112,6 +107,22 @@ import * as gestures from './menu-gestures'; directives: [forwardRef(() => MenuBackdrop)] }) export class Menu extends Ion { + private _preventTime: number = 0; + private _cntEle: HTMLElement; + private _gesture: Gesture; + private _targetGesture: Gesture; + private _type: MenuType; + opening: EventEmitter = new EventEmitter(); + isOpen: boolean = false; + isEnabled: boolean = true; + backdrop: MenuBackdrop; + onContentClick: Function; + + @Input() content: any; + @Input() id: string; + @Input() side: string; + @Input() type: string; + @Input() maxEdgeStart; constructor( elementRef: ElementRef, @@ -122,11 +133,6 @@ export class Menu extends Ion { private zone: NgZone ) { super(elementRef); - - this.opening = new EventEmitter('opening'); - this.isOpen = false; - this._preventTime = 0; - this.isEnabled = true; } /** @@ -134,7 +140,6 @@ export class Menu extends Ion { */ ngOnInit() { let self = this; - let content = self.content; self._cntEle = (content instanceof Node) ? content : content && content.getNativeElement && content.getNativeElement(); @@ -390,9 +395,10 @@ export class Menu extends Ion { /** * @private */ - static register(name, cls) { + static register(name: string, cls: new(...args: any[]) => MenuType) { menuTypes[name] = cls; } + //static register(name:string , cls: typeof MenuType) { /** * @private @@ -431,8 +437,8 @@ export class Menu extends Ion { } -let menuTypes = {}; -let menuIds = 0; +let menuTypes:{ [name: string]: new(...args: any[]) => MenuType } = {}; +let menuIds:number = 0; @Directive({ @@ -441,11 +447,9 @@ let menuIds = 0; '(click)': 'clicked($event)' } }) -class MenuBackdrop { +export class MenuBackdrop { - constructor(@Host() menu: Menu, elementRef: ElementRef) { - this.menu = menu; - this.elementRef = elementRef; + constructor(@Host() private menu: Menu, public elementRef: ElementRef) { menu.backdrop = this; } diff --git a/ionic/components/nav/view-controller.ts b/ionic/components/nav/view-controller.ts index 5fe2ffd27e..2bbbacd713 100644 --- a/ionic/components/nav/view-controller.ts +++ b/ionic/components/nav/view-controller.ts @@ -28,7 +28,7 @@ export class ViewController { public id: string; private _leavingOpts: any = null; private _onDismiss: Function = null; - private _nav: NavController; + protected _nav: NavController; private _nbTmpRef: TemplateRef; private _nbVwRef: ViewContainerRef; private _pgRef: ElementRef;