
var Widget = require ('./widget');

module.exports = new Class
({
	Extends: Widget
	,Tag: 'htk-spinner'
	
	,_started: false

	,initialize: function (props)
	{
		var loader = this.createElement ('div');
		loader.className = 'htk-spinner';
		
		var spin = document.createElement ('div');
		loader.appendChild (spin);
		
		this.spin = spin;
		this.parent (props);
	}
	
	,start: function ()
	{
		if (!this._started)
		{
			Vn.Node.addClass (this.spin, 'spinner');
			this._started = true;
		}
	}
	
	,stop: function ()
	{
		if (this._started)
		{
			Vn.Node.removeClass (this.spin, 'spinner');
			this._started = false;
		}
	}
});

