forked from kriskbx/gitlab-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
53 lines (47 loc) · 1.43 KB
/
index.js
File metadata and controls
53 lines (47 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var extend = require('util-extend');
// Spinner types.
extend(Spinner, {
Box1 : '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏',
Box2 : '⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓',
Box3 : '⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆',
Box4 : '⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋',
Box5 : '⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁',
Box6 : '⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈',
Box7 : '⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈',
Spin1 : '|/-\\',
Spin2 : '◴◷◶◵',
Spin3 : '◰◳◲◱',
Spin4 : '◐◓◑◒',
Spin5 : '▉▊▋▌▍▎▏▎▍▌▋▊▉',
Spin6 : '▌▄▐▀',
Spin7 : '╫╪',
Spin8 : '■□▪▫',
Spin9 : '←↑→↓'
});
// Spinner.
function Spinner(){
this.frames = [];
this.length = 0;
this.pos = 0;
}
// Set frames to the given string which must not use spaces.
Spinner.prototype.set = function(frames){
this.frames = frames;
this.length = this.frames.length;
}
// Next returns the next rune in the sequence.
Spinner.prototype.next = function(){
var r = this.frames[this.pos%this.length]
this.pos++
return r
}
// Reset the spinner to its initial frame.
Spinner.prototype.reset = function(){
this.pos = 0
}
// Returns a spinner initialized with Default frames.
module.exports = function(){
var s = new Spinner();
s.set(Spinner.Box1);
return s
}