chore(): make members private

This commit is contained in:
Adam Bradley
2015-11-15 20:37:24 -06:00
parent 9ef27f8c56
commit 13fa14dff6
24 changed files with 301 additions and 140 deletions

View File

@@ -4,8 +4,8 @@ import {Form} from '../../util/form';
import {Config} from '../../config/config';
import {pointerCoord} from '../../util/dom';
/**
* @name mediaSwitch
* @private
*/
@Directive({
@@ -99,12 +99,7 @@ class MediaSwitch {
directives: [MediaSwitch]
})
export class Switch {
/**
* TODO
* @param {ElementRef} elementRef TODO
* @param {Config} config TODO
* @param {NgControl=} ngControl TODO
*/
constructor(
form: Form,
elementRef: ElementRef,
@@ -157,6 +152,9 @@ export class Switch {
};
}
/**
* @private
*/
onInit() {
this.labelId = 'label-' + this.inputId;
}
@@ -177,10 +175,16 @@ export class Switch {
this.check(!this.checked);
}
/**
* @private
*/
writeValue(value) {
this.checked = value;
}
/**
* @private
*/
pointerDown(ev) {
if (/touch/.test(ev.type)) {
this.lastTouch = Date.now();
@@ -196,6 +200,9 @@ export class Switch {
this.isActivated = true;
}
/**
* @private
*/
pointerUp(ev) {
if (this.isDisabled(ev)) return;
@@ -213,18 +220,28 @@ export class Switch {
this.isActivated = false;
}
// Used by the view to update the model (Control)
// Up to us to call it in update()
/**
* @private
*/
registerOnChange(fn) { this.onChange = fn; }
/**
* @private
*/
registerOnTouched(fn) { this.onTouched = fn; }
/**
* @private
*/
onDestroy() {
this.removeMoveListener();
this.switchEle = this.addMoveListener = this.removeMoveListener = null;
this.form.deregister(this);
}
/**
* @private
*/
isDisabled(ev) {
return (this.lastTouch + 999 > Date.now() && /mouse/.test(ev.type)) || (this.mode == 'ios' && ev.target.tagName == 'ION-SWITCH');
}