2016-09-26 09:28:47 +00:00
|
|
|
|
|
|
|
var Widget = require ('./widget');
|
|
|
|
|
|
|
|
module.exports = new Class
|
2015-11-19 13:57:23 +00:00
|
|
|
({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Widget
|
2015-11-19 13:57:23 +00:00
|
|
|
,Tag: 'htk-spinner'
|
2016-05-02 13:05:49 +00:00
|
|
|
|
|
|
|
,_started: false
|
2015-11-19 13:57:23 +00:00
|
|
|
|
2016-10-16 14:16:08 +00:00
|
|
|
,render: function ()
|
2015-11-19 13:57:23 +00:00
|
|
|
{
|
2016-10-16 14:16:08 +00:00
|
|
|
var loader = this.createRoot ('div');
|
2015-11-19 13:57:23 +00:00
|
|
|
loader.className = 'htk-spinner';
|
|
|
|
|
2016-10-16 14:16:08 +00:00
|
|
|
var spin = this.spin = this.createElement ('div');
|
2015-11-19 13:57:23 +00:00
|
|
|
loader.appendChild (spin);
|
|
|
|
}
|
|
|
|
|
|
|
|
,start: function ()
|
|
|
|
{
|
2016-10-16 14:16:08 +00:00
|
|
|
if (this._started)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Vn.Node.addClass (this.spin, 'spinner');
|
|
|
|
this._started = true;
|
2015-11-19 13:57:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,stop: function ()
|
|
|
|
{
|
2016-10-16 14:16:08 +00:00
|
|
|
if (!this._started)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Vn.Node.removeClass (this.spin, 'spinner');
|
|
|
|
this._started = false;
|
2015-11-19 13:57:23 +00:00
|
|
|
}
|
|
|
|
});
|
2016-09-26 09:28:47 +00:00
|
|
|
|