Ethan Dalool
c7e4bf16d2
For the purposes of editor.js this does not bring much improvement, but now I can easily make spinners for other things.
31 lines
663 B
JavaScript
31 lines
663 B
JavaScript
var spinner = {};
|
|
|
|
spinner.Spinner =
|
|
function Spinner(element)
|
|
{
|
|
this.show = function(delay)
|
|
{
|
|
clearTimeout(this.delayed_showing_timeout);
|
|
this.delayed_showing_timeout = null;
|
|
|
|
if (! delay)
|
|
{
|
|
this.element.classList.remove("hidden");
|
|
}
|
|
else
|
|
{
|
|
this.delayed_showing_timeout = setTimeout(this.show, delay);
|
|
}
|
|
}
|
|
|
|
this.hide = function()
|
|
{
|
|
clearTimeout(this.delayed_showing_timeout);
|
|
this.delayed_showing_timeout = null;
|
|
|
|
this.element.classList.add("hidden");
|
|
}
|
|
|
|
this.delayed_showing_timeout = null;
|
|
this.element = element;
|
|
}
|