text: import { default as Window } from './Window';
  import { default as AttributedString } from './AttributedString';
  
  export default class RefreshControl {
  
  	constructor (object) {
  		if (object && object.apiName && object.apiName.endsWith('.UI.RefreshControl')) {
  			this._object = object;
  		} else {
  			this._object = Titanium.UI.createRefreshControl(normalize(object));
  		}
  	}
  
  	// constants
  	static get apiName () {
  		return Titanium.UI.RefreshControl.apiName;
  	}
  
  	// properties
  	get apiName () {
  		return this._object.apiName;
  	}
  	get bubbleParent () {
  		return this._object.bubbleParent;
  	}
  	set bubbleParent (value) {
  		this._object.bubbleParent = value;
  	}
  	get lifecycleContainer () {
  		return new Window(this._object.lifecycleContainer);
  	}
  	set lifecycleContainer (value) {
  		this._object.lifecycleContainer = value;
  	}
  	get title () {
  		return new AttributedString(this._object.title);
  	}
  	set title (value) {
  		this._object.title = value;
  	}
  	get tintColor () {
  		return this._object.tintColor;
  	}
  	set tintColor (value) {
  		this._object.tintColor = value;
  	}
  
  	// methods
  	addEventListener (name, callback) {
  		if (!callback) {
  			return new Promise(resolve => this._object.addEventListener(name, resolve));
  		}
  		return this._object.addEventListener(name, callback);
  	}
  	applyProperties (props) {
  		props = normalize(props);
  		return this._object.applyProperties(props);
  	}
  	fireEvent (name, event) {
  		event = normalize(event);
  		return this._object.fireEvent(name, event);
  	}
  	removeEventListener (name, callback) {
  		if (!callback) {
  			return new Promise(resolve => this._object.removeEventListener(name, resolve));
  		}
  		return this._object.removeEventListener(name, callback);
  	}
  	beginRefreshing () {
  		return this._object.beginRefreshing();
  	}
  	endRefreshing () {
  		return this._object.endRefreshing();
  	}
  	getApiName () {
  		return this._object.getApiName();
  	}
  	getBubbleParent () {
  		return this._object.getBubbleParent();
  	}
  	setBubbleParent (bubbleParent) {
  		return this._object.setBubbleParent(bubbleParent);
  	}
  	getLifecycleContainer () {
  		return new Window(this._object.getLifecycleContainer());
  	}
  	setLifecycleContainer (lifecycleContainer) {
  		lifecycleContainer = normalize(lifecycleContainer);
  		return this._object.setLifecycleContainer(lifecycleContainer);
  	}
  	getTitle () {
  		return new AttributedString(this._object.getTitle());
  	}
  	setTitle (title) {
  		title = normalize(title);
  		return this._object.setTitle(title);
  	}
  	getTintColor () {
  		return this._object.getTintColor();
  	}
  	setTintColor (tintColor) {
  		return this._object.setTintColor(tintColor);
  	}
  
  	// modules
  };
  Object.freeze(RefreshControl);
  
  function normalize (object) {
  	if (typeof object === 'object') {
  		if (object._object) {
  			return object._object;
  		}
  
  		for (let key in object) {
  			if (typeof object[key] === 'object') {
  				if (object[key]._object) {
  					object[key] = object[key]._object;
  				}
  			}
  		}
  	}
  
  	return object;
  }