3const Progress = keys => {
4 const stack = new Set(keys.filter(key => key))
5 const loaded = new Set()
6 const failed = new Set()
9 return loaded.size / stack.size
12 this.percentage = () => {
13 return (100 * this.ratio()).toFixed(2)
16 const render = () => `
17 <div class='${loaded.size !== stack.size ? 'busy' : 'done'}'>
19 ${'|'.repeat(this.ratio() * 10)}
20 ${loaded.size !== stack.size ? this.percentage() + '% ' : ''}
21 ${loaded.size === stack.size ? 'Complete' : 'Loading'}
22 ${failed.size !== 0 ? `(${failed.size} failed)` : ''}
27 const didLoad = (key, success) => new Promise((resolve, reject) => {
30 if (!success) failed.add(key)
38 success: key => didLoad(key, true),
39 failure: key => didLoad(key, false),
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list