From 8830059b2013588898f55d3fb1de94ff11cf3be8 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 28 Aug 2015 12:35:24 -0700 Subject: [PATCH] docs wip --- ionic/components/action-menu/action-menu.ts | 4 +- ionic/components/app/register.ts | 23 ++++++- ionic/components/aside/aside-toggle.ts | 13 +++- ionic/components/aside/aside.ts | 74 +++++++++++++++++++-- 4 files changed, 105 insertions(+), 9 deletions(-) diff --git a/ionic/components/action-menu/action-menu.ts b/ionic/components/action-menu/action-menu.ts index 4e66fe653e..b43055a938 100644 --- a/ionic/components/action-menu/action-menu.ts +++ b/ionic/components/action-menu/action-menu.ts @@ -67,7 +67,8 @@ export class ActionMenu extends Overlay { * Create and open a new Action Menu. This is the * public API, and most often you will only use ActionMenu.open() * - * @return Promise that resolves when the action menu is open. + * @param {Object} [opts={}] TODO + * @return {Promise} Promise that resolves when the action menu is open. */ open(opts={}) { let config = this.config; @@ -85,6 +86,7 @@ export class ActionMenu extends Overlay { /** * TODO + * @returns {TODO} TODO */ get() { return Modal.getByType(OVERLAY_TYPE); diff --git a/ionic/components/app/register.ts b/ionic/components/app/register.ts index 5b25b57dd9..363124c517 100644 --- a/ionic/components/app/register.ts +++ b/ionic/components/app/register.ts @@ -4,6 +4,9 @@ import {Ion} from '../ion'; import {IonicApp} from './app'; +/** + * TODO + */ @Directive({ selector: '[register]', properties: [ @@ -15,11 +18,17 @@ import {IonicApp} from './app'; } }) export class Register { - + /** + * TODO + * @param {Object} app TODO + */ constructor(app: IonicApp) { this.app = app; } + /** + * TODO + */ onInit() { if (this.register && this.registerId) { this.app.register(this.registerId, this.register); @@ -28,7 +37,9 @@ export class Register { } - +/** + * TODO + */ @Directive({ selector: '[ref]', properties: [ @@ -40,11 +51,19 @@ export class Register { }) export class Ref { + /** + * TODO + * @param {TODO} app TODO + * @param {TODO} component TODO + */ constructor(app: IonicApp, @Self() component: any) { this.app = app; console.log('Register on any', component) } + /** + * TODO + */ onInit() { /* if (this.register && this.registerId) { diff --git a/ionic/components/aside/aside-toggle.ts b/ionic/components/aside/aside-toggle.ts index 80938fc962..09247f8771 100644 --- a/ionic/components/aside/aside-toggle.ts +++ b/ionic/components/aside/aside-toggle.ts @@ -2,7 +2,9 @@ import {Directive} from 'angular2/angular2'; import {IonicApp} from '../app/app'; - +/** +* TODO +*/ @Directive({ selector: '[aside-toggle]', host: { @@ -10,12 +12,19 @@ import {IonicApp} from '../app/app'; } }) export class AsideToggle { - + /** + * TODO + * @param {IonicApp} app TODO + */ constructor(app: IonicApp) { //TODO(mlynch): don't hard code this, evaluate with ref system this.aside = app.getComponent('menu'); } + /** + * TODO + * @param {TODO} event TODO + */ toggle(event) { this.aside && this.aside.toggle(); } diff --git a/ionic/components/aside/aside.ts b/ionic/components/aside/aside.ts index f99be3a1b3..3968d180fa 100644 --- a/ionic/components/aside/aside.ts +++ b/ionic/components/aside/aside.ts @@ -11,7 +11,6 @@ import {dom} from 'ionic/util' /** * TODO (?) add docs about how to have a root aside and a nested aside, then hide the root one */ - @IonicComponent({ selector: 'ion-aside', properties: [ @@ -42,7 +41,11 @@ import {dom} from 'ionic/util' directives: [forwardRef(() => AsideBackdrop)] }) export class Aside extends Ion { - + /** + * TODO + * @param {IonicApp} app TODO + * @param {ElementRef} elementRef Reference to the element. + */ constructor(app: IonicApp, elementRef: ElementRef, config: IonicConfig) { super(elementRef, config); @@ -59,10 +62,16 @@ export class Aside extends Ion { }) } + /** + * TODO + */ onDestroy() { app.unregister(this); } + /** + * TODO + */ onInit() { super.onInit(); this.contentElement = (this.content instanceof Node) ? this.content : this.content.getNativeElement(); @@ -71,28 +80,52 @@ export class Aside extends Ion { this.typeDelegate = this.getDelegate('type'); } + /** + * TODO + * @return {Element} The Aside's content element. + */ getContentElement() { return this.contentElement; } + /** + * TODO + * @param {TODO} v TODO + */ setOpenAmt(v) { this.opening.next(v); } + /** + * TODO + * @param {boolean} willOpen TODO + */ setDoneTransforming(willOpen) { this.typeDelegate.setDoneTransforming(willOpen); } + /** + * TODO + * @param {TODO} transform TODO + */ setTransform(transform) { this.typeDelegate.setTransform(transform) } + /** + * TODO + * @param {boolean} isSliding TODO + */ setSliding(isSliding) { if (isSliding !== this.isSliding) { this.typeDelegate.setSliding(isSliding) } } + /** + * TODO + * @param {boolean} isChanging TODO + */ setChanging(isChanging) { if (isChanging !== this.isChanging) { this.isChanging = isChanging @@ -100,6 +133,11 @@ export class Aside extends Ion { } } + /** + * Sets the state of the Aside to open or not. + * @param {boolean} isOpen If the Aside is open or not. + * @return {Promise} TODO + */ setOpen(isOpen) { if (isOpen !== this.isOpen) { this.isOpen = isOpen @@ -114,21 +152,35 @@ export class Aside extends Ion { } } + /** + * TODO + * @return {TODO} TODO + */ open() { return this.setOpen(true); } + /** + * TODO + * @return {TODO} TODO + */ close() { return this.setOpen(false); } + /** + * TODO + * @return {TODO} TODO + */ toggle() { return this.setOpen(!this.isOpen); } } - +/** + * TODO + */ @Component({ selector: 'ion-aside-backdrop', host: { @@ -138,11 +190,16 @@ export class Aside extends Ion { '(click)': 'clicked($event)' } }) - @View({ template: '' }) export class AsideBackdrop extends Ion { + /** + * TODO + * @param {ElementReg} elementRef TODO + * @param {IonicConfig} config TODO + * @param {Aside} aside TODO + */ constructor(elementRef: ElementRef, config: IonicConfig, @Host() aside: Aside) { super(elementRef, config); @@ -152,12 +209,21 @@ export class AsideBackdrop extends Ion { this.backgroundColor = 'rgba(0,0,0,0)'; } + + /** + * TODO + */ onInit() { let ww = window.innerWidth; let wh = window.innerHeight; this.width = ww + 'px'; this.height = wh + 'px'; } + + /** + * TODO + * @param {TODO} event TODO + */ clicked(event) { this.aside.close(); }