X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Flib%2FOldSchoolSpinner.js;fp=www%2Fjssrc%2Flib%2FOldSchoolSpinner.js;h=3c359e2c4eb55804479fad06712f66a5c926ea4d;hb=4c3823106abb40d31797b51eeb047018698afc12;hp=0000000000000000000000000000000000000000;hpb=f4fcda2f29d7c2efe91d9afabf7d5fcd4bd04b5a;p=blerg.git diff --git a/www/jssrc/lib/OldSchoolSpinner.js b/www/jssrc/lib/OldSchoolSpinner.js new file mode 100644 index 0000000..3c359e2 --- /dev/null +++ b/www/jssrc/lib/OldSchoolSpinner.js @@ -0,0 +1,27 @@ +enyo.kind({ + name: "OldSchoolSpinner", + kind: "Control", + style: "font-family: Inconsolata, Consolas, Fixedsys, fixed, monospace; font-size: 16px", + content: '|', + steps: '/-\\|', + step: 0, + animationInterval: null, + destroy: function() { + this.stop(); + this.inherited(arguments); + }, + start: function() { + if (this.animationInterval) + return; + + this.animationInterval = setInterval(this.animate.bind(this), 100); + }, + stop: function() { + clearInterval(this.animationInterval); + this.animationInterval = null; + }, + animate: function() { + this.step = (this.step + 1) % this.steps.length; + this.setContent(this.steps[this.step]); + } +});