mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(): make members private
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user