chore(): prefix private methods

This commit is contained in:
mhartington
2015-12-18 14:54:12 -05:00
parent 344619d7d7
commit 0f64bccc43
9 changed files with 35 additions and 36 deletions

View File

@ -42,23 +42,23 @@ import {IonicApp} from './app';
}) })
export class IdRef { export class IdRef {
constructor(private app: IonicApp, private elementRef: ElementRef, private appViewManager: AppViewManager) { constructor(private _app: IonicApp, private _elementRef: ElementRef, private _appViewManager: AppViewManager) {
// Grab the component this directive is attached to // Grab the component this directive is attached to
this.component = appViewManager.getComponent(elementRef); this.component = _appViewManager.getComponent(_elementRef);
} }
/** /**
* @private * @private
*/ */
ngOnInit() { ngOnInit() {
this.app.register(this.id, this.component); this._app.register(this.id, this.component);
} }
/** /**
* @private * @private
*/ */
ngOnDestroy() { ngOnDestroy() {
this.app.unregister(this.id); this._app.unregister(this.id);
} }
} }
@ -80,12 +80,12 @@ export class IdRef {
}) })
export class Attr { export class Attr {
constructor(private renderer: Renderer, private elementRef: ElementRef) {} constructor(private _renderer: Renderer, private _elementRef: ElementRef) {}
/** /**
* @private * @private
*/ */
ngOnInit() { ngOnInit() {
this.renderer.setElementAttribute(this.elementRef, this.attr, ''); this._renderer.setElementAttribute(this._elementRef, this.attr, '');
} }
} }

View File

@ -20,7 +20,7 @@ import {Directive, Renderer, ElementRef} from 'angular2/core';
selector: '[blur]' selector: '[blur]'
}) })
export class Blur { export class Blur {
constructor(private elementRef: ElementRef, private renderer: Renderer) { constructor(private _elementRef: ElementRef, private _renderer: Renderer) {
renderer.setElementStyle(elementRef, '-webkit-backdrop-filter', 'blur(10px)'); _renderer.setElementStyle(_elementRef, '-webkit-backdrop-filter', 'blur(10px)');
} }
} }

View File

@ -54,12 +54,11 @@ import {Form} from '../../util/form';
export class Checkbox { export class Checkbox {
constructor( constructor(
private form: Form, private _form: Form,
@Optional() ngControl: NgControl, @Optional() ngControl: NgControl,
elementRef: ElementRef elementRef: ElementRef
) { ) {
this.form = form; _form.register(this);
form.register(this);
this.onChange = (_) => {}; this.onChange = (_) => {};
this.onTouched = (_) => {}; this.onTouched = (_) => {};
@ -75,7 +74,7 @@ export class Checkbox {
*/ */
ngOnInit() { ngOnInit() {
if (!this.id) { if (!this.id) {
this.id = 'chk-' + this.form.nextId(); this.id = 'chk-' + this._form.nextId();
} }
this.labelId = 'lbl-' + this.id; this.labelId = 'lbl-' + this.id;
@ -132,6 +131,6 @@ export class Checkbox {
* @private * @private
*/ */
ngOnDestroy() { ngOnDestroy() {
this.form.deregister(this); this._form.deregister(this);
} }
} }

View File

@ -40,9 +40,9 @@ import {Config} from '../../config/config';
export class Icon { export class Icon {
constructor( constructor(
private elementRef: ElementRef, private _elementRef: ElementRef,
config: Config, config: Config,
private renderer: Renderer private _renderer: Renderer
) { ) {
this.config = config; this.config = config;
this.mode = config.get('iconMode'); this.mode = config.get('iconMode');
@ -52,7 +52,7 @@ export class Icon {
* @private * @private
*/ */
ngOnInit() { ngOnInit() {
let ele = this.elementRef.nativeElement; let ele = this._elementRef.nativeElement;
if (this.mode == 'ios' && this.ios) { if (this.mode == 'ios' && this.ios) {
this.name = this.ios; this.name = this.ios;
@ -113,12 +113,12 @@ export class Icon {
if (this._name !== this.name) { if (this._name !== this.name) {
if (this._name) { if (this._name) {
this.renderer.setElementClass(this.elementRef, this._name, false); this._renderer.setElementClass(this._elementRef, this._name, false);
} }
this._name = this.name; this._name = this.name;
this.renderer.setElementClass(this.elementRef, this.name, true); this._renderer.setElementClass(this._elementRef, this.name, true);
this.renderer.setElementAttribute(this.elementRef, 'aria-label', this._renderer.setElementAttribute(this._elementRef, 'aria-label',
this.name.replace('ion-', '').replace('ios-', '').replace('md-', '').replace('-', ' ')); this.name.replace('ion-', '').replace('ios-', '').replace('md-', '').replace('-', ' '));
} }
} }

View File

@ -34,8 +34,8 @@ import {List} from '../list/list';
}) })
export class ItemSliding { export class ItemSliding {
constructor(@Optional() private list: List, elementRef: ElementRef) { constructor(@Optional() private _list: List, elementRef: ElementRef) {
list.enableSlidingItems(true); _list.enableSlidingItems(true);
elementRef.nativeElement.$ionSlide = ++slideIds; elementRef.nativeElement.$ionSlide = ++slideIds;
} }
@ -43,7 +43,7 @@ export class ItemSliding {
* @private * @private
*/ */
close() { close() {
this.list.closeSlidingItems(); this._list.closeSlidingItems();
} }
} }

View File

@ -42,9 +42,9 @@ export class Label {
constructor( constructor(
config: Config, config: Config,
@Optional() container: TextInput, @Optional() container: TextInput,
private form: Form, private _form: Form,
private elementRef: ElementRef, private _elementRef: ElementRef,
private renderer: Renderer private _renderer: Renderer
) { ) {
this.scrollAssist = config.get('scrollAssist'); this.scrollAssist = config.get('scrollAssist');
this.container = container; this.container = container;
@ -55,7 +55,7 @@ export class Label {
*/ */
ngOnInit() { ngOnInit() {
if (!this.id) { if (!this.id) {
this.id = 'lbl-' + this.form.nextId(); this.id = 'lbl-' + this._form.nextId();
} }
this.container && this.container.registerLabel(this); this.container && this.container.registerLabel(this);
} }
@ -94,7 +94,7 @@ export class Label {
* @private * @private
*/ */
addClass(className) { addClass(className) {
this.renderer.setElementClass(this.elementRef, className, true); this._renderer.setElementClass(this._elementRef, className, true);
} }
} }

View File

@ -37,13 +37,13 @@ import {Menu} from './menu';
}) })
export class MenuClose { export class MenuClose {
constructor(private app: IonicApp) {} constructor(private _app: IonicApp) {}
/** /**
* @private * @private
*/ */
close() { close() {
let menu = Menu.getById(this.app, this.menuClose); let menu = Menu.getById(this._app, this.menuClose);
menu && menu.close(); menu && menu.close();
} }

View File

@ -60,7 +60,7 @@ export class RadioGroup extends Ion {
elementRef: ElementRef, elementRef: ElementRef,
config: Config, config: Config,
@Optional() ngControl: NgControl, @Optional() ngControl: NgControl,
@Query(ListHeader) private headerQuery: QueryList<ListHeader> @Query(ListHeader) private _headerQuery: QueryList<ListHeader>
) { ) {
super(elementRef, config); super(elementRef, config);
this.ngControl = ngControl; this.ngControl = ngControl;
@ -76,7 +76,7 @@ export class RadioGroup extends Ion {
* @private * @private
*/ */
ngOnInit() { ngOnInit() {
let header = this.headerQuery.first; let header = this._headerQuery.first;
if (header) { if (header) {
if (!header.id) { if (!header.id) {
header.id = 'radio-header-' + this.id; header.id = 'radio-header-' + this.id;
@ -203,7 +203,7 @@ export class RadioButton extends Ion {
@Host() @Optional() group: RadioGroup, @Host() @Optional() group: RadioGroup,
elementRef: ElementRef, elementRef: ElementRef,
config: Config, config: Config,
private form: Form private _form: Form
) { ) {
super(elementRef, config); super(elementRef, config);
@ -217,7 +217,7 @@ export class RadioButton extends Ion {
ngOnInit() { ngOnInit() {
super.ngOnInit(); super.ngOnInit();
if (!this.id) { if (!this.id) {
this.id = 'rb-' + this.form.nextId(); this.id = 'rb-' + this._form.nextId();
} }
this.labelId = 'lbl-' + this.id; this.labelId = 'lbl-' + this.id;

View File

@ -111,7 +111,7 @@ export class Toggle {
form: Form, form: Form,
elementRef: ElementRef, elementRef: ElementRef,
config: Config, config: Config,
@Optional() private ngControl: NgControl @Optional() private _ngControl: NgControl
) { ) {
// deprecated warning // deprecated warning
if (elementRef.nativeElement.tagName == 'ION-SWITCH') { if (elementRef.nativeElement.tagName == 'ION-SWITCH') {
@ -129,8 +129,8 @@ export class Toggle {
this.onChange = (_) => {}; this.onChange = (_) => {};
this.onTouched = (_) => {}; this.onTouched = (_) => {};
if (ngControl) { if (_ngControl) {
ngControl.valueAccessor = this; _ngControl.valueAccessor = this;
} }
let self = this; let self = this;