3c359e2c4eb55804479fad06712f66a5c926ea4d
[blerg.git] / www / jssrc / lib / OldSchoolSpinner.js
1 enyo.kind({
2     name: "OldSchoolSpinner",
3     kind: "Control",
4     style: "font-family: Inconsolata, Consolas, Fixedsys, fixed, monospace; font-size: 16px",
5     content: '|',
6     steps: '/-\\|',
7     step: 0,
8     animationInterval: null,
9     destroy: function() {
10         this.stop();
11         this.inherited(arguments);
12     },
13     start: function() {
14         if (this.animationInterval)
15             return;
16
17         this.animationInterval = setInterval(this.animate.bind(this), 100);
18     },
19     stop: function() {
20         clearInterval(this.animationInterval);
21         this.animationInterval = null;
22     },
23     animate: function() {
24         this.step = (this.step + 1) % this.steps.length;
25         this.setContent(this.steps[this.step]);
26     }
27 });