chore: default tabs

This commit is contained in:
Nathan Walker
2020-07-09 23:46:02 -07:00
parent 8100cf7089
commit 41f0573d8e
353 changed files with 55344 additions and 55344 deletions

View File

@@ -3,9 +3,9 @@
import { ControlStateChangeListener as ControlStateChangeListenerDefinition } from '.';
export class ControlStateChangeListener implements ControlStateChangeListenerDefinition {
constructor(control: any /* UIControl */, callback: (state: string) => void) {
console.log('ControlStateChangeListener is intended for IOS usage only.');
}
public start() {}
public stop() {}
constructor(control: any /* UIControl */, callback: (state: string) => void) {
console.log('ControlStateChangeListener is intended for IOS usage only.');
}
public start() {}
public stop() {}
}

View File

@@ -3,13 +3,13 @@
* WARNING: This class is intended for IOS only.
*/
export class ControlStateChangeListener {
/**
* Initializes an instance of ControlStateChangeListener class.
* @param control An instance of the UIControl which state will be watched.
* @param callback A callback called when a visual state of the UIControl is changed.
*/
constructor(control: any /* UIControl */, callback: (state: string) => void);
/**
* Initializes an instance of ControlStateChangeListener class.
* @param control An instance of the UIControl which state will be watched.
* @param callback A callback called when a visual state of the UIControl is changed.
*/
constructor(control: any /* UIControl */, callback: (state: string) => void);
start();
stop();
start();
stop();
}

View File

@@ -2,67 +2,67 @@
import { ControlStateChangeListener as ControlStateChangeListenerDefinition } from '.';
class ObserverClass extends NSObject {
// NOTE: Refactor this - use Typescript property instead of strings....
observeValueForKeyPathOfObjectChangeContext(path: string) {
if (path === 'selected') {
this['_owner']._onSelectedChanged();
} else if (path === 'enabled') {
this['_owner']._onEnabledChanged();
} else if (path === 'highlighted') {
this['_owner']._onHighlightedChanged();
}
}
// NOTE: Refactor this - use Typescript property instead of strings....
observeValueForKeyPathOfObjectChangeContext(path: string) {
if (path === 'selected') {
this['_owner']._onSelectedChanged();
} else if (path === 'enabled') {
this['_owner']._onEnabledChanged();
} else if (path === 'highlighted') {
this['_owner']._onHighlightedChanged();
}
}
}
export class ControlStateChangeListener implements ControlStateChangeListenerDefinition {
private _observer: NSObject;
private _control: UIControl;
private _observing: boolean = false;
private _observer: NSObject;
private _control: UIControl;
private _observing: boolean = false;
private _callback: (state: string) => void;
private _callback: (state: string) => void;
constructor(control: UIControl, callback: (state: string) => void) {
this._observer = ObserverClass.alloc().init();
this._observer['_owner'] = this;
this._control = control;
this._callback = callback;
}
constructor(control: UIControl, callback: (state: string) => void) {
this._observer = ObserverClass.alloc().init();
this._observer['_owner'] = this;
this._control = control;
this._callback = callback;
}
public start() {
if (!this._observing) {
this._control.addObserverForKeyPathOptionsContext(this._observer, 'highlighted', NSKeyValueObservingOptions.New, null);
this._observing = true;
this._updateState();
}
}
public start() {
if (!this._observing) {
this._control.addObserverForKeyPathOptionsContext(this._observer, 'highlighted', NSKeyValueObservingOptions.New, null);
this._observing = true;
this._updateState();
}
}
public stop() {
if (this._observing) {
this._observing = false;
this._control.removeObserverForKeyPath(this._observer, 'highlighted');
}
}
public stop() {
if (this._observing) {
this._observing = false;
this._control.removeObserverForKeyPath(this._observer, 'highlighted');
}
}
//@ts-ignore
private _onEnabledChanged() {
this._updateState();
}
//@ts-ignore
private _onEnabledChanged() {
this._updateState();
}
//@ts-ignore
private _onSelectedChanged() {
this._updateState();
}
//@ts-ignore
private _onSelectedChanged() {
this._updateState();
}
//@ts-ignore
private _onHighlightedChanged() {
this._updateState();
}
//@ts-ignore
private _onHighlightedChanged() {
this._updateState();
}
private _updateState() {
let state = 'normal';
if (this._control.highlighted) {
state = 'highlighted';
}
this._callback(state);
}
private _updateState() {
let state = 'normal';
if (this._control.highlighted) {
state = 'highlighted';
}
this._callback(state);
}
}